Steven Bethard <steven.bethard <at> gmail.com> writes:
> Here's a simple implementation using __slots__:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502237
That's pretty cool! Two suggestions:
1. rename the _items method to __iter__, so that you have easy casting
to tuple and lists;
2. put a check in the metaclass such as
``assert '__init__' not in bodydict`` to make clear to the users
that they cannot override the __init__ method, that's the metaclass job.
Great hack!
Michele Simionato
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com