Mateusz Loskot :: hacking on, working out, living up

Python WTF of the day

22 Sep 2011 | mloskot

Update: The rant has been suspended, temporarily.

The code speaks for itself:

>>> class A:
...     def foo(a, ):
...             pass
...
>>>
>>> a = A()
>>> a.foo()
>>> a.foo(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: foo() takes exactly 1 positional argument (2 given)
>>>

I confess, I am a Python newbie. I climb the rocky curve of the Python C API for the first time trying to write custom Python generators. I still know very little about Python. This is not the last time Python’s bitten me ass.

Fork me on GitHub