/code-this-not-that-python-edition

10 tips to make your code more Pythonic

Primary LanguagePython

Code this ✅ Not that ❌ - Python Edition

10 Tips to make your code more Pythonic.

  • Learn the pythonic way to make a null check.
  • Use the "in" keyword to check if a variable is included in an iterable.
  • Use list comprehensions for simple loops.
  • Use any/all.
  • Learn the purpose of enumerate and zip.
  • Use tuple unpacking.
  • Learn about Python's syntax for a ternary operator.
  • Use generators.
  • Be careful with mutable default arguments
  • Use context managers.