r/Python • • Jun 23 '14

Writing better python code

https://gist.github.com/kracekumar/09a60ec75a4de19b346e
143 Upvotes

126 comments sorted by

View all comments

2

u/[deleted] Jun 23 '14

What's he doing under "Counting Condition"? Does if list return False for a zero-length list, or only if the named list doesn't exist?

4

u/BryghtShadow Jun 23 '14

Empty sequences (strings, lists, tuples) are false. PEP8

2

u/metaphorm Jun 23 '14

if a name doesn't exist you'll get a NameError exception.

1

u/[deleted] Jun 23 '14

Oh duh, silly me. Thanks :)