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”.
Related Posts:
- Python – ‘ascii’ codec can’t decode byte
- TypeError: ‘int’ object is not subscriptable
- What is the difference between rw+ and r+
- TypeError: ‘int’ object is not callable
- TypeError: ‘int’ object is not callable
- TypeError: ‘int’ object is not callable
- raw_input function in Python
- Cannot find module cv2 when using OpenCV
- Cannot find module cv2 when using OpenCV
- Python ‘If not’ syntax [duplicate]
- RuntimeWarning: invalid value encountered in divide
- Converting dictionary to JSON
- WinError 2 The system cannot find the file specified (Python)
- IndexError: tuple index out of range —– Python
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- Could not find a version that satisfies the requirement tensorflow
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- Could not find a version that satisfies the requirement tensorflow
- ln (Natural Log) in Python
- Python Traceback (most recent call last)
- write() versus writelines() and concatenated strings
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- How to pip or easy_install tkinter on Windows
- Cannot find module cv2 when using OpenCV
- Convert list to tuple in Python
- No module named MySQLdb
- Why are Python’s ‘private’ methods not actually private?
- How do you use subprocess.check_output() in Python?
- Remove list from list in Python
- How to create a new text file using Python
- TypeError: write() argument must be str, not bytes (Python 3 vs Python 2 )
- python socket.error: [Errno 98] Address already in use
- How to import files in python using sys.path.append?
- How do I install the yaml package for Python?
- Check string “None” or “not” in Python 2.7
- Change figure size and figure format in matplotlib
- How can I concatenate str and int objects?
- how to update spyder on anaconda
- how does \r (carriage return) work in Python
- What is Python buffer type for?
- AttributeError(“‘str’ object has no attribute ‘read'”)
- IndexError: index 1 is out of bounds for axis 0 with size 1/ForwardEuler
- Python Save to file
- Create 3D array using Python
- TypeError: unsupported operand type(s) for -: ‘list’ and ‘list’
- ImportError: No module named scipy
- AttributeError: ‘datetime’ module has no attribute ‘strptime’
- Python add item to the tuple
- Converting binary to decimal integer output
- How can I read pdf in python?
- No module named setuptools
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- AttributeError(“‘str’ object has no attribute ‘read'”)
- How to use 2to3 properly for python?
- How to fix: “UnicodeDecodeError: ‘ascii’ codec can’t decode byte”
- Difference between scikit-learn and sklearn
- Type error Unhashable type:set
- UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 20: ordinal not in range(128)
- How to detect key presses?
- What is the difference between json.load() and json.loads() functions
- Python: count repeated elements in the list
- How to XOR two strings in Python
- TypeError: ‘_io.TextIOWrapper’ object is not subscriptable
- Copy a list of list by value and not reference
- Why I get ‘list’ object has no attribute ‘items’?
- Split a python list into other “sublists” i.e smaller lists
- scrapy run spider from script
- python error: TypeError: an integer is required
- If list index exists, do X
- Python Requests – No connection adapters
- How to detect key presses?
- Numpy, multiply array with scalar
- Installation of pygame with Anaconda
- urllib and “SSL: CERTIFICATE_VERIFY_FAILED” Error
- ‘virtualenv’ is not recognized as an internal or external command, operable program or batch file
- How can I copy a Python string?
- Split string using a newline delimiter with Python
- No module named urllib3
- Convert string to variable name in python
- AttributeError: ‘tuple’ object has no attribute
- Adding +1 to a variable inside a function
- How to open html file?
- “Python version 2.7 required, which was not found in the registry” error when attempting to install netCDF4 on Windows 8
- Installing scipy for python 2.7
- Install py2exe for python 2.7 over pip: this package requires Python 3.3 or later
- ImportError: No module named IPython
- Does python have header files like C/C++?
- What exactly do “u” and “r” string flags do, and what are raw string literals?
- In python, how can I print lines that do NOT contain a certain string, rather than print lines which DO contain a certain string:
- input() error – NameError: name ‘…’ is not defined
- Symbol not found: __PyCodecInfo_GetIncrementalDecoder
- Using print() (the function version) in Python2.x
- Python 2.7 mixing iteration and read methods would lose data
- Homebrew brew doctor warning about /Library/Frameworks/Python.framework, even with brew’s Python installed
- What does an ‘r’ represent before a string in python?
- How to read a CSV file from a URL with Python?
- Python list index out of range on return value of split
- Python: OSError: [Errno 2] No such file or directory: ”
- How to import a csv-file into a data array?