python-2.1 function attributes
Paul Prescod
paulp at ActiveState.com
Wed Jan 24 23:18:36 EST 2001
Mike Romberg wrote:
>
> ...
>
> The second syntax proposed in pep 232 does not strike me as
> elegant. But, it does seem to be consistant with doc strings in that
> they are defined (but not referenced) first thing in the function
> definition:
>
> def spam():
> """The doc string."""
> { 'attribute1' : 'val1', 'attribute2' : val2 }
> pass
I proposed a similar syntax to Guido a couple of years ago and he
pointed out that it is unclear whether "val2" should be evaluated in the
runtime context of spam() or in the global context. The former is what
the syntax suggests but the latter is the only way to have the feature
work properly.
Paul Prescod
More information about the Python-list
mailing list