Empty string is False right?
Scott David Daniels
Scott.Daniels at Acm.Org
Sat Jan 31 12:48:24 EST 2009
Steve Holden wrote:
> AJ Ostergaard wrote:
>> I'm not suggesting it's not operating as advertised - I'm suggesting the
>> 'advertising' is slightly sguiffy if you catch my drift. I guess it's
>> just me that finds it slightly counter intuitive. Surely intuitively the
>> expression is "and" and therefore should always return a boolean?
...
> You might think so, and it wouldn't be an entirely unreasonable thought,
> but in practice it makes a lot of sense to retain the original value
> where possible.
For example:
print name_from_form or default_name
or:
main(sys.arg[1:] or ['default', 'args'])
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list