None or 0

itsy bitsy meowbot 53ab2750 at meowing.net
Sat Sep 7 11:42:36 EDT 2002


Michael Ströder wrote:
> >>> repr(0 or None)
> 'None'
> >>> repr(None or 0)
> '0'
> >>> repr('' or None)
> 'None'
> >>> repr(None or '')
> "''"
> >>>
> 
> Is it guaranteed to work like this or should that be avoided?

That's what the language reference specifies, in Doc/ref/lambda.html --
but each of the 73 Python license layers disclaims responsibiilty for
anything, so Pythonlabs are still free to change it if they're feeling
particularly mean and nasty, so don't tick them off.



More information about the Python-list mailing list