Skip to content

Instantly share code, notes, and snippets.

@uucidl
Created March 15, 2016 08:45
Show Gist options
  • Save uucidl/2a51ffcae6f72d77d4d0 to your computer and use it in GitHub Desktop.
Save uucidl/2a51ffcae6f72d77d4d0 to your computer and use it in GitHub Desktop.
Something insane I did not know about python
H:\temp>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 'hello'
>>> print a
hello
>>> words = [a for a in ['one', 'two', 'three']]
>>> print words
['one', 'two', 'three']
>>> print a
three
>>>
@uucidl
Copy link
Author

uucidl commented Mar 15, 2016

Yeah this reminds me a lot of JavaScript. I thought python had more scopes.. I guess I'll liberally enclose most of my scopes in local functions from now on, unless it's at the expense of clarity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment