PyWart: The problem with "print"
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Jun 4 00:30:24 EDT 2013
On Tue, 04 Jun 2013 05:16:13 +0200, Vito De Tullio wrote:
> Rick Johnson wrote:
>
>> Take your
>> standard yes/no/cancel dialog, i would expect it to return
>> True|False|None respectively,
>
> you clearly mean True / False / FileNotFound.
>
> ( http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx )
No no, he actually means
return True
return False
raise an exception
Or perhaps
0
1
2
Or perhaps:
'yes'
'no'
'cancel'
like all right-thinking people expect *wink*
Of course the one thing that a programmer should never, ever do, under
pain of maybe having to learn something, is actually check the
documentation of an unfamiliar library or function before making
assumptions of what it will return. If you follow this advice, you too
can enjoy the benefits of writing buggy code.
--
Steven
More information about the Python-list
mailing list