PEP 285: Adding a bool type
Rich Harkins
rich at worldsinfinite.com
Tue Apr 2 07:43:46 EST 2002
On Monday 01 April 2002 04:49 pm, Steve Holden wrote:
> "Gustavo Niemeyer" <niemeyer at conectiva.com> wrote in message
> news:mailman.1017673984.1773.python-list at python.org...
>
> > Hi Martin!
> >
[snip]
>
> Arguably, most of that code should have read
>
> if ret:
> ...
>
> rather than
>
> if ret == None:
> ...
>
> since the latter has the flavor of "if expr==True".
>
> So, is breaking bad code more excusable than breaking good code ;-)?
>
> regards
> Steve
Hmmm... this is slightly OT for the thread but I have made a bit of a habit
of doing the following:
if result is None: # As opposed to result == None
stuff
This is somewhat out of paranoia, and slightly out of interest in speed (my
recollection is that previous Python versions could end up calling __coerce__
on comparisons with None and in many of these cases I didn't really want
that). Is there any compelling reason not to do this? Isn't None to be a
singleton in perpetuity?
Rich
More information about the Python-list
mailing list