homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cool-RR
Recipients cool-RR
Date 2014年09月19日.20:30:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1411158620.58.0.416699245015.issue22446@psf.upfronthosting.co.za>
In-reply-to
Content
Can't this code:
 class Sequence(Sized, Iterable, Container):
 # ...
 def __contains__(self, value):
 for v in self:
 if v == value:
 return True
 return False
Be shortened into this: 
 class Sequence(Sized, Iterable, Container):
 # ...
 def __contains__(self, value):
 return any(item == value for value in self)
Which can even fit on one line with a lambda: 
 class Sequence(Sized, Iterable, Container):
 # ...
 __contains__ = lambda self: any(item == value for value in self)
History
Date User Action Args
2014年09月19日 20:30:20cool-RRsetrecipients: + cool-RR
2014年09月19日 20:30:20cool-RRsetmessageid: <1411158620.58.0.416699245015.issue22446@psf.upfronthosting.co.za>
2014年09月19日 20:30:20cool-RRlinkissue22446 messages
2014年09月19日 20:30:20cool-RRcreate

AltStyle によって変換されたページ (->オリジナル) /