Skip to content

Instantly share code, notes, and snippets.

@daGrevis
Last active December 16, 2015 13:29
Show Gist options
  • Select an option

  • Save daGrevis/5442176 to your computer and use it in GitHub Desktop.

Select an option

Save daGrevis/5442176 to your computer and use it in GitHub Desktop.

What I don't like about Python

  • It's easy to get tuple where you wanted to have string and vice-versa,
In [1]: x = (
   ...:   "a",
   ...:   "b",
   ...:   "c",
   ...: )

In [2]: x
Out[2]: ('a', 'b', 'c')

In [3]: x = (
   ...:   "a",
   ...:   "b"
   ...:   "c",
   ...: )

In [4]: x
Out[4]: ('a', 'bc')
-foo = "bar",
+foo = "bar"
  • It's easy to forget @ before decorator and it will kinda work — just not as you expect it,
-transaction.commit_manually(using="default")
+@transaction.commit_manually(using="default")
  • Documentation is missing API-like version where you can see all functions, classes, methods, attributes etc.,

  • It's easy "to create a class" with "def" statement (the correct way is to use "class" statement") and then wonder why something isn't working properly (it's not a syntax error),

def MyClass(OtherClass):
    def my_func(self):
        pass

    def other_func(self):
        pass
  • Misleading exception on circular imports, it says ImportError: cannot import name X,

  • It's easy to type x in None (instead of x is None) and have fun debugging later;

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