Skip to content

Instantly share code, notes, and snippets.

@pfreixes
Created February 24, 2019 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfreixes/65db5634a5723d0ffd6d3af18eaf0f5a to your computer and use it in GitHub Desktop.
Save pfreixes/65db5634a5723d0ffd6d3af18eaf0f5a to your computer and use it in GitHub Desktop.
Scope Python
$ python
Python 3.7.2 (default, Jan 13 2019, 12:51:54)
[Clang 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> dir()
['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__']
>>> f = [1, 2, 3]
>>> dir()
['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'f']
>>> for x in f:
... pass
...
>>> dir()
['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'f', 'x']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment