python-2.1 function attributes

Carel Fellinger cfelling at iae.nl
Thu Jan 25 12:13:55 EST 2001


Duncan Booth <duncan.booth at lineone.net> wrote:
> Paul Prescod <paulp at ActiveState.com> wrote in 
> <mailman.980396369.12407.python-list at python.org>:
...
> How about something along the following lines?

> __attributes__= { 'attribute1' : 'val1', 'attribute2' : val2 }
> def spam():
>     """The doc string."""
>     pass

or even better(?) after the def but before spam making it visual clear
that it belongs to spam's definition, but hasn't access to anything but
the enclosing scope, like in:

def { 'attribute1' : 'val1', 'attribute2' : val2 } spam():
    """The doc string."""
    pass

this only works nice for litteral dicts, so bumber.
-- 
groetjes, carel



More information about the Python-list mailing list