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-05 08:24:15
|
On Nov 4, 2003, at 10:56 PM, SourceForge.net wrote: > Bugs item #836247, was opened at 2003-11-05 03:56 > Message generated for change (Tracker Item Submitted) made by Item > Submitter > You can respond by visiting: > https://sourceforge.net/tracker/? > func=detail&atid=114534&aid=836247&group_id=14534 This bug exposes a fairly obnoxious problem in the current implementation of PyObjC: there are not separate namespaces for class and instance methods, so you end up with stupid problems when you have some class that implements the same selector for both the instance and class. There's a lot of pretty common selectors that are like this: +[NSObject description] -[NSObject description] .. etc .. I did discover a workaround, which is ClassObject.bothClassAndInstanceMethod(ClassObject).. for example: >>> NSObject.description(NSObject) u'<NSObject: 0xa0a04e40>' Ideally one would be able to do NSObject.description().. which means that the descriptor has to know about these "class or instance" methods. It's also, as far as I know, not possible to override the class implementation for a selector if an instance implementation exists (from Python). So my question is, how the heck do we approach this? It seems that the current selector objects/descriptors need to be changed quite a bit in order to facilitate this, especially allowing one to do it from Python. Perhaps we can change the selector function to take a class function, instance function, or both.. and throw away isClassMethod. We can add a flag on the selector that says "I have both a class and an instance". I'm pretty new to these internals.. so, Ronald, do you want to handle this one? Or give me some ideas as to how this should be done? -bob |