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/044375.html below:

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

[Python-Dev] slots, properties, descriptors, and pydocGuido van Rossum guido at python.org
Sun Apr 18 13:21:29 EDT 2004
> Ok.  Can anyone suggest an unobtrusive way to set docstrings on slots?
> 
> Perhaps this (but how could it be implemented?):
> 
>      class Foo(object):
>          __slots__ = docslots(
>              ('slot1': 'description'),
>              ('slot2':
>                  """description
>                  ...continued
>                  """),
>              'slot3',
>          )

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).

--Guido van Rossum (home page: http://www.python.org/~guido/)


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