A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2007-February/071305.html below:

[Python-Dev] A "record" type (was Re: Py2.6 ideas)

[Python-Dev] A "record" type (was Re: Py2.6 ideas) [Python-Dev] A "record" type (was Re: Py2.6 ideas)Michele Simionato michele.simionato at gmail.com
Wed Feb 21 05:55:35 CET 2007
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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4