I run py-backwards on ModernGL
$ py-backwards -i ModernGL -o compiled -t 2.7
Compilation succeed:
target: 2.7
files: 14
took: 5.31 seconds
Additional dependencies:
six
I the compiled version still contains lines like this:
class Buffer:
def read(self, size=(- 1), *, offset=0):
However this syntax is invalid in python2 the * argument must be removed.
The result should be:
class Buffer:
def read(self, size=(- 1), offset=0):
Sample code using * in python3:
>>> def foo(pos, *, forcenamed):
... print(pos, forcenamed)
...
>>> foo(pos=10, forcenamed=20)
10 20
>>> foo(10, forcenamed=20)
10 20
>>> foo(10, 20)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: foo() takes exactly 1 positional argument (2 given)
Useful link: Forced naming of parameters in Python