map(faceIndexes.append, [55,68,69,70,72] + range(75,93+1) + [254])
import itertools
map(faceIndexes.append, itertools.chain([55,68,69,70,72], xrange(75,93+1), [254]))
import itertools
for val in itertools.chain([55,68,69,70,72], xrange(75,93+1), [254]):
faceIndexes.append(val)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ff560c31-f903-42c9-95d8-d05a8d6fffee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
aah ok thanks Justin, i don't quite understand why they would be classed as None values because they are integers right? or maybe they don't have a type when mapped.
nums = range(5)
print nums
# [0,1,2,3,4]
doubled = map(lambda i: i*2, nums)
print doubled
# [0,2,4,6,8]
aList = []
results = map(aList.append, [1,2,3,4,5])
print aList
# [1, 2, 3, 4, 5]
print results
# [None, None, None, None, None]
but yes this is working nicely, thank you
Sam
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5d6d8668-c042-4fb6-b35c-91edf6426130%40googlegroups.com.
On Wed, 11 Nov 2015 1:33 AM <s...@weacceptyou.com> wrote:
Oh ok, i get it now. thanks Justin. Would that garbage list be bad because it takes up memory or compute time or just bad programming practice?
a, b, and c :-)
If map() didn't return anything, then it would be fine. Also in python3, map() is now a generator (like itertools.imap). So your usage would end up breaking. The generator returned from that version of map() would have to be looped over, completely, to have it apply the function to every item and get your side effect. But if you throw away the resulting generator, nothing happens
http://xahlee.info/python/python3_map_with_side_effect.html
thanks, last time,
Sam;)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0f7b5430-dfcb-4285-8974-e575e9475311%40googlegroups.com.