On Thu, Jan 17, 2013 at 03:10:45PM +0200, Ilkka Pelkonen <ilkka.pelkonen@iki.fi> wrote:
It's not that it can't be done, just that it does something you don't expect. I've been professionally working with C++ for nine years in large-scale Windows systems, and I do expect a boolean expression return a boolean value.
It does something Python developers expect. It's a well-known behaviour and there are many programs that rely on that behaviour.
Or, can you show me an example how the developer would benefit of the current behavior? Any operator traditionally considered as boolean will do.
address = user and user.address if address is None: raise ValueError("Unknown address") In the example neither user nor user.address are allowed to be None. Oleg. -- Oleg Broytman http://phdru.name/ phd@phdru.name Programmers don't die, they just GOSUB without RETURN.