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

[Python-Dev] method decorators (PEP 318)

[Python-Dev] method decorators (PEP 318) [Python-Dev] method decorators (PEP 318)Peter Otten Peter.Otten at t-online.de
Fri Mar 26 15:28:39 EST 2004
Yet another variant that deals with "passive" metadata: make the first 
dictionary special just like the first string.

>>> def foobar():
...     { author = "van Rossum",
...       deprecated = True }
...
>>> foobar.deprecated
True

Even better, stash it all away in a another attribute:

>>> foobar.__meta__
{"author": "van Rossum", "deprecated": "not yet"}

This would work for both functions and classes. Fitting in nicely: the 
alternative spelling for all dictionaries:

{alpha="value", beta="another value"}

Peter Otten


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