Closure/binding problem or misunderstanding

Bob.Sidebotham at gmail.com Bob.Sidebotham at gmail.com
Fri Nov 9 10:13:26 EST 2007


On Nov 9, 9:54 am, Boris Borcic <bbor... at gmail.com> wrote:

> Yes this is the expected behavior. Both your getpath() functions return the
> current value of the single path variable at the time of invocation. Perhaps
> this would be the slightest bit clearer if subdir.iteritems() did not provide
> your items in swapped order (so that the returned values would be "this is two").

Yes, this helps, too. It's actually quite elegantly simple (it's just
not fully obvious (from the manual) until you completely grok the way
namespaces work).

Thanks,
Bob




More information about the Python-list mailing list