is None or == None ?
Alf P. Steinbach
alfps at start.no
Fri Nov 6 21:49:41 CET 2009
> Alf P. Steinbach wrote:
>> Note that the object implementation's complexity doesn't have to affect to
>> any other code since it's trivial to provide abstract accessors (even
>> macros), i.e., this isn't part of a trade-off except if the original
>> developer(s) had limited
>> resources -- and if so then it wasn't a trade-off at the language design
>> level but a trade-off of getting things done then and there.
> But remember what got us in here: your belief (which followed from your
> assumptions) that computing `is` required testing the object types.
Yes, I couldn't believe what I've now been hearing. Uh, reading. :-)
> might optimize out the "extra indirection" to get an object's value, but
> you'd need the "extra indirection" anyway to find out what type it was
> before you could use it.
No, that type checking is limited (it just checks whether the type is special
cased), doesn't involve indirection, and is there anyway except for 'is'. It can
be moved around but it's there, or something more costly is there. 'is' is about
the only operation you /can/ do without checking the type, but I don't see the
point in optimizing 'is' at cost of all other operations on basic types.
Cheers & hth.,
More information about the Python-list