Re: [Pyobjc-dev] Auto bridging instances by conversion
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2003-02-04 09:01:59
|
Ronald Oussoren wrote: > > I don't see why the id should matter either. From a Python > > perspective, all that matters is that the two objects compare and > > hash equally. Sure, comparison is _cheaper_ when the two objects > > have the same id, but would stuff actually _break_ if the id's > > weren't the same? That's just sick. > > Not necessarily, I'm sure we can come up with sane scenarios where > object identity is used other than as a performance hack. Sure, eg. in Python this happens with exceptions. However we're not talking about arbitrary objects, but about real basic immutable types (strings and numbers). I claim that any code in which the id of an NSNumber or NSString is important is seriously broken. > > Regarding numbers: from ObjC -> Python there will be hardly a > > difference between conversion and wrapping: for both cases a new > > object needs to be allocated (except when the number is between -1 > > and 99 in which case conversion is _cheaper_). > And likewise for Python->ObjC: A new object will be created. Not for a wrapped NSNumber, when you would just pass the original object back. Just |