Re: [Pyobjc-dev] [ pyobjc-Bugs-836247 ] NSWindow.contentRectForFrameRect_styleMask_ not a class meth
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2003-11-07 15:01:25
|
On Nov 7, 2003, at 6:34 AM, Jack Jansen wrote: > > On 5 Nov 2003, at 23:44, Bob Ippolito wrote: >>>> NSObject.foo() # smart decision by the selector (smarter than >>>> instance if it has one, see previous email) >>>> NSObject.foo.classMethod() # classmethod >>>> NSObject.foo.instanceMethod() # instanceMethod >>> >>> That would make "NSObject.foo" a funny sort of object. In the >>> current scheme NSObject.foo is a perfectly normal object, either an >>> unbound method or a class method. >> >> Except that it has a signature, isClassMethod, etc. It's not a >> perfectly normal object, it's a selector instance. One of the big >> "selling points" of ObjC is that you can pretty much translate ObjC >> code to Python, this is a stumbling block I think we should work >> around. > > Hmm, you have a point. If I look at this then sometimes I agree with > you, sometimes I agree with myself. It really depends on whether you > take a Pythonic view or on ObjC-view. Well the way I see it is this. Making selectors more magical will make ObjC code work more often without "change". The only thing that *might* break is doing SomeClass.someInstanceSelector(someInstance, ...) -- but people only really do that if someInstance is a string or something weird is going on with PyObjC.. I really don't think this change would cause any problems, and I don't think that the classMethod/instanceMethod members would ever really need to be used, but would be there as a backup plan in case for some reason PyObjC guessed wrong and you really want to use a instance method that was taken off the class. classMethod is only there for symmetry, it would never be necessary. -bob |