Skip to content

Take advantage of super() functionality in python3.x

Duncan Macleod requested to merge github/fork/alurban/super into master

Created by: alurban

This PR utilizes python3.x-specific behavior of the builtin super() function. In short, as of python3.x, if super() is being called with no arguments from within a class definition it will automatically infer the parent class and current instance.

Two special cases to note:

  • Python2.7-style metaclasses interfere with single inheritance, so in order to use super in its zero-argument form, I've removed any dependence on six.add_metaclass from gwpy/cli/cliproduct.py. This duplicates part of #1222.
  • Occasionally we want to avoid inheriting from the direct parent, e.g. when it does fancy things we don't strictly need. In these cases super is still called in its two-argument form.

More information can be found in the Python documentation.

cc @duncanmmacleod

Merge request reports