python-2.1 function attributes

Carel Fellinger cfelling at iae.nl
Fri Jan 26 09:22:56 EST 2001


"Tony J Ibbs (Tibs)" <tony at lsl.co.uk> wrote:
...
> Of course, we already have ways in Python to allow continuation over
> lines and indenting for a list of items - and I'd have said the obvious
> one to use here *was* the dictionary specification, which takes us back
> to:

>  def f(long_name, even_longer_name, still_longer_name) with \
>          (publish=1, secure=0, grammar=f_grammar):
>      """and here is the doc string."""
>      print "bobbins"

Can we use this second parameter list for closures as well?  Moreover,
I most definitely would expect to be able to refer to publish etc within
the function body without having to qualify it with the funtion name.
And are assignments to those function attributes allowed within the 
function body?

> I'm still a little concerned about the use of "with" as the keyword,
> though, since it has precedent for uses where the value being defined is
> a "local" constant - but on the other hand I can't think of a better
> word at the moment.

But it is local, local to f.

-- 
groetjes, carel



More information about the Python-list mailing list