Which is more pythonic?
Lie Ryan
lie.1296 at gmail.com
Thu Dec 3 21:46:53 EST 2009
On 12/4/2009 11:44 AM, Rhodri James wrote:
>> map(self.__choices, choicesBox.addItem)
>>
>> or
>>
>> [choicesBox.addItem(choice) for choice in self.__choices]
Aside from being pythonic or non-pythonic, using map or list
comprehension with a method with side-effect is not the intention of
functional programming; which strives to eliminates side-effect
altogether. So it's unfunctional.
The only pythonic form to use method with side effect is an explicit for.
More information about the Python-list
mailing list