pythonでの質問です。
class NewStyleClassBase(object):
def test_method(self,msg): print('NewStyleClassBase:{}'.format(msg))
class NewStyleClass(NewStyleClassBase):
def test_method(self,msg): priunt('NewStyleClass:{}'.format(msg)) super().test_method(msg)
new = NewStyleClass
new.test_method('method call')
と入力したら
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
=============== RESTART: C:/Users/rad71/Downloads/python.we.py ===============
Traceback (most recent call last):
File "C:/Users/rad71/Downloads/python.we.py", line 7, in <module>
class NewStyleClass(NewStyleClassBase):
NameError: name 'NewStyleClassBase' is not defined
と出ます。
何がおかしいのか教えてください。
このソースはpython-izmというpython勉強サイトの応用編の親クラスのメソッドの呼び出しというところです。
そこに載っていたソースを真似たつもりだったのですが、、、
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/07 17:38
2019/03/07 17:45