[Python-3000] PEP for Metaclasses in Python 3000 (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sat Mar 10 08:31:32 CET 2007
- Previous message: [Python-3000] PEP for Metaclasses in Python 3000
- Next message: [Python-3000] PEP for Metaclasses in Python 3000
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Talin wrote:
class Foo(base1, base2, metaclass=mymeta): ...
-1 on this syntax, I think it's ugly.
Alternative proposals:
class Foo(base1, base2) as MyMeta: ...
or
class Foo(base1, base2) = MyMeta: ...
class Foo(base1, base2, metaclass=mymeta, private=True): ...
class Foo(base1, base2) as MyMeta(private=True): ...
or
class Foo(base1, base2) = MyMeta(private=True): ...
This attribute is a method named metacreate
Very bad choice of name -- it's not creating a meta-anything, and gives no clue what it is creating.
It would be possible to leave the existing metaclass syntax in place. Alternatively, it would not be too difficult to modify the syntax rules of the Py3K translation tool to convert from the old to the new syntax.
The existing syntax actually has some advantages, e.g. you can do things like
class Foo: class metaclass: # Real class methods defined here
which I think is rather elegant, so I'm not sure I'd like the new syntax to completely replace the old one.
-- Greg
- Previous message: [Python-3000] PEP for Metaclasses in Python 3000
- Next message: [Python-3000] PEP for Metaclasses in Python 3000
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]