I try to learn Python 2.7. When i run this code:
class MyClass:
def PrintList1(*args):
for Count, Item in enumerate(args):
print("{0}. {1}".format(Count, Item))
def PrintList2(**kwargs):
for Name, Value in kwargs.items():
print("{0} likes {1}".format(Name, Value))
MyClass.PrintList1("Red", "Blue", "Green")
MyClass.PrintList2(George="Red", Sue="Blue",Zarah="Green")
i get a TypeError:
MyClass.PrintList1("Red", "Blue", "Green")
TypeError: unbound method PrintList1() must be called with MyClass instance as first argument (got str instance instead)
>>>
Why?
selfparameter? Frankly, there seems to be no point these methods being in a class at all.