Re: [Pyobjc-dev] Re: Making List<->Array bridging transparent
Brought to you by:
ronaldoussoren
From: <bb...@ma...> - 2002-11-09 18:27:10
|
On Saturday, November 9, 2002, at 09:42 AM, Peter Montagner wrote: > How is either method going to solve the splice problem if the splice > code is trying to access the list directly? Did I understand that > correctly? Python has been moving to using the types-- string, int, etc..-- as inheritable classes for some time. As such, you can do things like: >>> class FooInt(int): pass ... >>> x = FooInt(1) >>> x 1 >>> type(x) <class '__main__.FooInt'> >>> x + 1 2 That is, for all intents and purposes, instances of 'FooInt' behave exactly like any old 'int'. So, if we were able to make an encapsulated NSArray inherit from the base class 'list' on the Python side, it would behave exactly like any other 'list' in all contexts. There is some subtlety -- for example, the '2' in the above example really is an 'int' and not a 'FooInt'. To preserve it as a FooInt, I would need to redefine all of the math operations (__add__, etc) on FooInt to return instances of FooInt. Of course, I can't do anything about it [I don't think] if FooInt is the operand -- i.e. in the case of '1 + x'. Or something like that... I haven't fully wrapped my head around this stuff yet. > BTW, how long do you think it will take Apple to include Python 2.3 in > the default install? If we are lucky, it may make it into 10.3 assuming that Python 2.3 goes stable at least three months in advance of the release of 10.3. I really can't imagine 10.3 coming out before next summer given how much change there was in 10.0->10.1 and 10.1->10.2 and assuming that that amount of change is a decent benchmark. Then again, Apple has been absolutely ripping through 10.2.x updates since the release of 10.2. Ronald: Can you point me to the bug that you filed and a description of the fix? Is a workaround possible? As much as I hate to limit our feature set, I feel it is absolutely critical that PyObjC remain compatible with the Python distributed by Apple. b.bum |