Weird Python: A few ways in which Python can misbehave
09-07, 16:20–16:55 (Europe/Lisbon), Auditorium

Python usually works the way we expect to, but sometimes it doesn't. This talk is about when to expect the unexpected.


Python has some weird interpreter quirks that behave in unexpected ways. In this talk, we will go over a few ways in which Python behaves unexpectedly:

  • Introduction: What this talk is about, and why it is important to steer clear of some known "gotchas"
  • Meat of the Talk: Going over examples of ways in which Python behaves weirdly:
    1. Mutable default arguments: When we provide mutable default arguments, some strange things might happen.
    2. Integer Caching: This is how the is operator can behave in weird ways, and sometimes it is not between -5 and 256 that the is operator works.
    3. Late Binding Closures: Python late-binds when creating functions within another function.
    4. Match/Case Weirdness: Match/Case statements actually assign the variables when binding values to variables.
  • Questions/Answers

Nafiul is a Software Engineer with over a decade of experience. He wrote a book called "Mastering PyCharm" and has spoken at multiple conferences. He has always been passionate about developer tools, and loves learning about new ones and understanding how they work.