News for hackers. Stuff that matters.
Re:PyFormat – Practical examples of old and new style string... by fragmede on Wednesday April 15, 2015 @06:16PM (#9384588)
Actually, if you reference 'a' at all in bar, it will work:

    def foo():
        a = 4
        def bar():
            a
            print("a = {a}".format(**locals()))
        bar() 
    foo()
successfully prints

    a = 4
which is a bit confusing, but makes sense if you think about it.

There are no comments on this comment yet.