list comprehensions
Aahz
aahz at pythoncraft.com
Mon Apr 12 22:20:26 EDT 2004
In article <slrnc7m71l.2id.ramen at lackingtalent.com>,
Dave Benjamin <ramen at lackingtalent.com> wrote:
>In article <c56n0j$9r8$1 at panix1.panix.com>, Aahz wrote:
>> In article <yjZcc.42823$Pk3.9547 at pd7tw1no>,
>> Elaine Jackson <elainejackson7355 at home.com> wrote:
>>>
>>>List comprehensions don't work the way you intuitively expect them
>>>to work. I realize many people have no intuitions about how list
>>>comprehensions 'should' work, so if you recognize yourself in this
>>>description, feel free to go back to whatever you were doing before. If
>>>you're still here, though, I invite you to consider the following
>>>definition:
>>
>> Short response: don't write complex listcomps.
>
>Would you consider a 2D loop too complex for a listcomp?
It depends. If it's something simple, go ahead. If you've got an
``if`` or a complex expression, I'd think real hard.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Why is this newsgroup different from all other newsgroups?
More information about the Python-list
mailing list