Python Peculiarities
summary
Using import can silently overwrite local variables (os.name replaces a local name), a numeric literal split like 5 .5 or similar confuses the parser and raises a syntax error, a shared default list persists across calls so appending twice yields [42, 42], a trailing comma creates tuple so calling .extend on that value fails, and the REPL binds the previous result to REPL _ stores last result* so chained multiplications produce 30 here. Use static analysis and PyCharm to catch these.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:03How it works
- 1:57Dont cheat
- 4:24Always has a poor name
- 5:23Syntax error
- 7:17Default parameters
- 11:39braces
- 13:42chameleon
- 16:04Johnny Cash
- 18:46Throwdown
related talks
26mPython Oddities Explained
27mPython Oddities Explained
31mLife Under the A Guide to Python's Internal Conventions
21mBecome a Better Pythonista by Abusing List Comprehensions and :=
49mSeven Things Every Python Programmer Should Know
01h 18mPython 103: Mmmm... Understanding Python's Memory Model, Mutability, and Methods
29mI wish I learnt that earlier!
01h 18mPython 103: Mmmm... Understanding Python's Memory Model, Mutability, and Methods
