Feature request: subclassing FunctionType [Was: Some language proposals]
Michele Simionato
michele.simionato at poste.it
Mon Mar 1 02:02:02 EST 2004
Jacek Generowicz <jacek.generowicz at cern.ch> wrote in message news:<tyfsmgtbewl.fsf at lxplus030.cern.ch>...
> I think that you are misleading yourself. You are comparing apples to
> quinces.
I thank you for the long post and the time you spent in clarifying the
issue I had; however, you are speaking to a converted, since I already
came to the same conclusion on my own (see my reply to Bengt Richter).
> So, you see, Python's scoping rules are just like Scheme's, in this
> sense. Unfortunately, I don't think that it's so easy (or even
> possible?) to demonstrate it the other way around (ie show a Scheme
> snippet in which add0(0) == add1(0) == 1)
See my reply to Bengt.
> Try the following:
>
> x = 3
> def show(): global x; print x
> show() # => 3
> x += 1
> show() # => 4
>
> def outer():
> x = 3
> def show(): print x
> show() # => 3
> x += 1
> show() # => 4
> outer()
>
> ... which prints out the numbers 3,4,3 and 4.
>
> You don't really believe that the last number should be 3, do you ?
No, I agree with you on every respect. It is just that Scheme hides
the issue; but it hides it so well that in practice you never do
the mistake.
Still, I maintain that the ability to subclass FunctionType would be nice ;)
Michele Simionato
More information about the Python-list
mailing list