closures and dynamic binding

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Mon Sep 29 08:49:44 CEST 2008


In message
<3c75ce4b-bb58-4da4-9b7a-87d7c5d5d2d0 at m45g2000hsb.googlegroups.com>,
Aaron "Castironpi" Brady wrote:

> [Wikipedia] says:
> "dynamic scoping can be dangerous and almost no modern languages use
> it", but it sounded like that was what closures use.

Closures will use whatever the language says they use. LISP used dynamic
binding, but this caused some interesting problems as mentioned above. Perl
allows both, depending on whether the local is declared with "local"
or "my". Python uses only lexical, though there's probably some way to get
dynamic behaviour if you want. :)



More information about the Python-list mailing list