pycon logo

PyCon 2011 Atlanta

March 9th–17th

Log in or Sign Up

How to write obfuscated python

log in to bookmark this presentaton

Experienced / Talk
March 11th 4:55 p.m. – 5:25 p.m.
With its clean, highly readable syntax, Python would seem to be quite a challenge for a programmer attempting to write obfuscated code. Fortunately, it provides a wide variety of high-level abstractions that can be misused in exciting ways. This survey of obfuscation strategies will include topics such as decorator abuse, lambda calculus, and bytecode manipulation.


Python's clean syntax can make traditional approaches to writing obfuscated code much more challenging. Fortunately, Python provides many useful abstractions that can be misused to write code that is unreadable or even deliberately misleading. This talk will provide a survey of silly python tricks that explore the boundaries of the language.


  • Redefining builtins
  • Rarely used syntax
  • Comparison edge cases
  • Things you probably shouldn't do with decorators
  • Fun with lambdas
  • Bytecode manipulation