Parameterized Functions without Classes
tismer at stackless.com
Fri Jun 25 19:46:25 CEST 2004
Oliver Fromme wrote:
> Christian Tismer <tismer at stackless.com> wrote:
> > just as a small comment on the side-effects of the
> > rather new concept of local functions with access to
> > their scope:
> > [...]
> > def _converter(scale):
> > def convert(arg):
> > return scale * arg
> > return convert
> In what way is that different from using an ordinary lambda
> function? i.e.:
There is no difference than the existing differences
between lambdas and def'ed functions.
The scope rules are the same.
> Of course, the use of lambda functions is very limited
> because (unfortunately) they can contain only one single
> expression. But other than that, it's pretty much the
> same concept, isn't it?
Lambdas were not the topic, since they are a deprecated
feature, but sure it works.
The intent of my post was to show a "clean" way to do
things classless, directed to newcomers.
It was not about showing all possible (and unrecommended)
ways to do it. That would have filled 5 pages :-)
ciao - chris
Christian Tismer :^) <mailto:tismer at stackless.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Python-list