Suggestions for python 2
Bernhard Herzog
herzog at online.de
Tue Jan 18 11:27:02 EST 2000
Markus Stenberg <mstenber at cc.Helsinki.FI> writes:
> Edward Welbourne <eddy at vortigen.demon.co.uk> writes:
[snip]
> > Three new kinds of argument come into being (with my given spelling):
> > * safe tunnel: after both * and **
> > * keyword-only: after * but not **
> > * positional-only: after ** but not *
>
> Ugh.. *puke* this looks like ugly hack from hell designed to counter
> Python's original debatable deficiency in namescape/scoping department.
> All examples I've seen to date have just provided ways of countering
> current scoping, and I'd rather see Python's scope system changing
> (possibly something along the lines mr. Skaller of Viper fame proposed)
> than language getting more and more cryptic with very little gain to show
> for it.
I'll second that. Turning a kludge that works because of an
implementation detail into an officially supported feature isn't a good
idea, IMO. Support for lexical scoping is the correct approach.
[snip]
> > You want to let your function see some value you can compute, but you
> > want it to be able to take arbitrarily many positional args; or you need
> > to be sure your caller can't mess with one of your args.
lexical scoping would take care of that, unless I'm missing something.
[snip]
> def filename(*fragments, root=os.getcwd()): ?
>
> It's not allowed right now, but looks pretty clear to me, and it's logical
> extension to current form.
IMO, this particular case -- keyword args after the * -- should be used
to declare arguments that have to be passed as keyword args, just like
Edward suggested.
--
Bernhard Herzog | Sketch, a drawing program for Unix
herzog at online.de | http://sketch.sourceforge.net/
More information about the Python-list
mailing list