Skip to content

Instantly share code, notes, and snippets.

@johnsyweb
Created November 11, 2016 23:37
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 johnsyweb/d1d60631cfe4d5e0001675d66d823b3b to your computer and use it in GitHub Desktop.
Save johnsyweb/d1d60631cfe4d5e0001675d66d823b3b to your computer and use it in GitHub Desktop.
Python surprise!
>>> l = []
>>> l[100:] = ['foo']
>>> l[100]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
@johnsyweb
Copy link
Author

If you know the why Python behaves this way, you can earn some imaginary Internet points here:
http://stackoverflow.com/q/40558529/78845

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