[Python-3000] PEP 3115: Actual use cases for odd metaclasses? Alternate syntax.

Phillip J. Eby pje at telecommunity.com
Sun Jan 13 21:27:51 CET 2008


At 10:55 AM 1/13/2008 -0800, Charles Merriam wrote:
>You have a legitimate counter-argument that grouping the
>implementations of __add__ in the metaclass is cleaner than having
>them stand alone and be referenced in.

You've misunderstood Michele's example code.  __add__ in the 
metaclass lets you add two *record classes* together, not two records.

Your proposal didn't support this behavior, nor *any other use case* 
for actually having a metaclass (as opposed to class decoration).

You might find this metaclass tutorial enlightening, especially the 
section I've linked to:

http://www.ibm.com/developerworks/linux/library/l-pymeta2/#h4

Understanding this will show you why your original proposal is 
completely broken for non-decorator use cases.



More information about the Python-3000 mailing list