circuitpython/tests/basics/subclass-native2-tuple.py
Paul Sokolovsky 66ab571cca tests: Update subclass-native2.py for __new__/__init__ refactor.
Now case of subclassing tuple works, and list is broken, see comments.
2014-05-19 21:56:07 +03:00

22 lines
306 B
Python

class Base1:
def __init__(self, *args):
print("Base1.__init__", args)
class Ctuple1(Base1, tuple):
pass
a = Ctuple1()
print(len(a))
a = Ctuple1([1, 2, 3])
print(len(a))
print("---")
class Ctuple2(tuple, Base1):
pass
a = Ctuple2()
print(len(a))
a = Ctuple2([1, 2, 3])
print(len(a))