[Python-ideas] A meaningful `if counter:`

cool-RR cool-rr at cool-rr.com
Wed Apr 6 10:00:58 CEST 2011


On Wed, Apr 6, 2011 at 9:57 AM, Raymond Hettinger <
raymond.hettinger at gmail.com> wrote:

>
> On Apr 5, 2011, at 11:59 PM, cool-RR wrote:
>
> > Okay, this argument applies against `Counter.__bool__`, but not against
> `Counter.elements().__bool__`. So I want to hear whether people would find a
>  `Counter.elements().__bool__` method useful.
> >
>
>
>
> if any(c.elements()):
>    ...
>
>
> Raymond
>


Cool, this will be good enough.


Ram.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110406/8d95537f/attachment.html>


More information about the Python-ideas mailing list