One added note: >> if greeting == True: >> if greeting is True: > > This one is based on the preference for identity checks when singletons are > involved, rather than equality tests. Being composed of English words, the > latter is also more readable. It's the same reason why you would do identity > checks against None or enum values. There is more to it that that -- == can be overridden for a particular class. So doing: X == None Could yield surprising results if __eq__ has been defined for the class X is bound to at the moment. Numpy arrays are a common case for me. As None is often used to mean undefined, X could be any type. Granted, in your code, you likely know what type(s) X is likely to be, but it's a good habit to get in to. -Chris > >> Please don't misunderstand me: I dislike the above intensely, but it's an >> emotional response based on 10-15 years of doing things the other way. I'm >> interested in arguments that don't include things like "it's pythonic" (which >> some people consider a derogatory term ;-)), or "just because", I trust that >> the stuff in pep8 was done with specific reasoning in mind, but I'm feeling >> rather useless at giving that reasoning and I'm hoping you can help :-) > > I hope those explanations give you the basis for why the choices were made. > They aren't arbitrary, although folks can and do disagree. It's much more > important that your project comes up with its own guidelines and applies them > self-consistently. For example, I have my own small set of refinements on top > of PEP 8. I'm not providing a link because they're a bit out of date > w.r.t. Python 3. ;) > > Cheers, > -Barry > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/chris.barker%40noaa.gov
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4