TypeError: super() takes at least 1 argument (0 given) error is specific to any python version?

Yes, the 0-argument syntax is specific to Python 3, see What’s New in Python 3.0 and PEP 3135 — New Super.

In Python 2 and code that must be cross-version compatible, just stick to passing in the class object and instance explicitly.

Yes, there are “backports” available that make a no-argument version of super() work in Python 2 (like the future library) but these require a number of hacks that include a full scan of the class hierarchy to find a matching function object. This is both fragile and slow, and simply not worth the “convenience”.

Leave a Comment