On Mon, Nov 30, 2009 at 4:24 AM, spir <denis.s...@free.fr> wrote: > which seems to indicate python really embeds "symbolic references" (*) to > outer *variables*, when creating a closure for g0. Not "pointer references" > (**), otherwise the replacement of x would not be seen by the closure --like > in the case of default-parameter. > Actually, I find this _Bad_. Obviously, the func's behaviour and result > depend on arbitrary external values (referentially opaque). What do you > think? >
I'm not sure *why*/how this behaviour really works, other than it treats x as a global variable... and probably treats n as something similar. I don't know how bad I find it - you should be declaring the variables you're planning to use in your function anyway... I'm sure there's *some* case that it would end out problematic, but I can't think of one ATM. -Wayne -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn’t. - Primo Levi
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor