A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-April/044380.html below:

[Python-Dev] slots, properties, descriptors, and pydoc

[Python-Dev] slots, properties, descriptors, and pydocJohn Belmonte john at neggie.net
Sun Apr 18 22:29:08 EDT 2004
Guido van Rossum wrote:
> Anything can be done using metaclasses.  __slots__ is not special
> once the class exists -- it is a set of instructions for the default
> metaclass to create a specific set of descriptors (and associated
> storage).  Another metaclass could use a different convention
> (although it may have to set __slots__ to let the base metaclass
> create the associated storage slots).

My original proposal was to use __slots__ dict values for docstrings in 
the default metaclass.  You said you'd rather not do that because 
different metaclasses may want to use the dict value for different 
purposes.  But from what you've explained, metaclasses are free to 
interpret the value of __slots__ in any way they choose.  Metaclasses 
built on top of the default metaclass could translate their __slots__ 
value to the __slots__ I proposed.

Are optional tuples any better?  This wouldn't preclude use of dict 
values for something else.

class Foo(object):
     __slots__ = [
         'slot1',
         ('slot2', 'description'),
         ('slot3', """description
             ...continued"""),
     ]


-John


-- 
http:// if  ile.org/

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