[Pythonmac-SIG] Categories for class methods

Ronald Oussoren ronaldoussoren at mac.com
Thu Jan 27 12:06:30 CET 2005


On 27-jan-05, at 6:34, Dethe Elza wrote:

>
> On 26-Jan-05, at 8:58 PM, Dethe Elza wrote:
>> class NSImage(Category(NSImage)):
>>
>>     def read_(cls, filepath):
>>         return NSImage.alloc().initWithhContentsOfFile_(filepath)
>>     read_ = classmethod(read_)
>
> er, that should be initWithContentsOfFile_, but still gets the same 
> error even without the typo.

It's a bug in PyObjC. objc.classAddMethod (which is used by the 
implementation of Category) doesn't handle classmethods correctly.

Ronald



More information about the Pythonmac-SIG mailing list