[PEAK] 'Categories' in Python

Phillip J. Eby pje at telecommunity.com
Fri Dec 10 19:07:47 EST 2004


At 04:30 PM 12/10/04 -0500, Andy Gross wrote:
>Hi All,
>
>I was playing around with decorators and metaclasses last night, and I 
>threw together a quick implementation of Objective-C style "Categories" 
>for Python.  In a nutshell, Categories are classes without data members, 
>just methods.

I'm having trouble seeing the benefit, versus just using generic functions 
(either single or multi-dispatch).  The only difference between them and 
what you're doing as far as I can see is that the calling signature would 
be 'toUpper(someObj)' instead of 'someObj.toUpper()'.  But apart from that 
that, there's not any difference.




More information about the PEAK mailing list