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 rhettinger
Recipients SilentGhost, altvod, bob.ippolito, ezio.melotti, r.david.murray, rhettinger, serhiy.storchaka, terry.reedy
Date 2017-04-23.16:31:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492965080.78.0.606176365062.issue27613@psf.upfronthosting.co.za>
In-reply-to
Content
Per PEP-8, the Python preferred-style is, "For sequences, (strings, lists, tuples), use the fact that empty sequences are false."

    Yes: if not seq:
        if seq:

    No: if len(seq):
        if not len(seq):

The Python libraries are not obliged to defend themselves against non-sensical types (i.e. defining an empty iterator as a subclass of list and returning a non-zero len).

I recommend leaving the code as-is and closing a "not a bug".  In a way, this report is no more interesting than observing that a __hash__ that returns a random value on each call doesn't work well in a dictionary.
History
Date User Action Args
2017-04-23 16:31:20rhettingersetrecipients: + rhettinger, terry.reedy, bob.ippolito, ezio.melotti, r.david.murray, SilentGhost, serhiy.storchaka, altvod
2017-04-23 16:31:20rhettingersetmessageid: <1492965080.78.0.606176365062.issue27613@psf.upfronthosting.co.za>
2017-04-23 16:31:20rhettingerlinkissue27613 messages
2017-04-23 16:31:20rhettingercreate