That context dot notation is pretty cool for creating global variables. Is there a way to create the same functionality in a notebook? I see context is an 'augmented dictionary' and I tried to initialize(context) in a notebook but that failed.
As a parallel ?, what is the 'pythonic' way to create and use global variables in a notebook (noting that if you assign to it in a function, it loses it's globality)?
Example 1:
foo = 2
def test():
print foo # Crash, local referenced before assignment
foo = 3
Example 2:
foo = 2
def test(foo):
foo = 3
return foo
foo = test(foo)
works but seems like there s/b a better way...
Thanks for looking!