[Chicago] April Talk Topic Python 3.2 Features
Brian Ray
brianhray at gmail.com
Tue Mar 13 13:24:12 CET 2012
On Mar 12, 2012, at 9:27 PM, "J. D. Jordan" <zanson at zanson.org> wrote:
> For the format thing, the {} has 0, because you are formatting
> argument 0. You could also make it table['Jack'] instead of 0['Jack']
> and have .format(table=table)
Makes sense, thanks.
>
> nonlocal means that it is scoped outside of the current scope, but not
> all the way up in global...
>
> def bob(myvar):
> def subfunc():
> nonlocal myvar
> return myvar * 10
> return subfunc
>
So, technically, nonlocal is the previous frame? I can think of some cases I want to check this out to see what it does. For instance, if a class has self.foo and within a method could I just nonlocal foo?
More information about the Chicago
mailing list