[Python-Dev] Re: redefining is (original) (raw)
Barry Scott nospam at barrys-emacs.org
Fri Mar 19 15:04:44 EST 2004
- Previous message: [Python-Dev] Re: redefining is
- Next message: [Python-Dev] Re: redefining is
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This is why you cannot mess with "is". We replaced all the "== None" with "is None" in our code to avoid tracebacks when the eq method fails on a None. yes there is a bug in the eq code, but I don't want the eq code run at all in almost all cases.
Barry
At 19-03-2004 18:54, Casey Duncan wrote:
> So I would consider 'if obj == None' correct, but unoptimized code.
The problem is that 'obj == None' is not the assertion you want to make usually. 'obj == None' means "obj claims it is equal to None", whereas 'obj is None' means 'obj is the None object'. The latter is a much more stringent assertion than the former which relies on the particular implementation of obj. -Casey
- Previous message: [Python-Dev] Re: redefining is
- Next message: [Python-Dev] Re: redefining is
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]