kuroko/test/testClassMethod.krk

19 lines
380 B
Python

class Foo():
def amethod():
print("If this were Python, I'd be impossible to call.")
@staticmethod
def astatic():
print("these are special now")
# This doesn't work because amethod is unbound and needs an instance.
try:
Foo.amethod()
except as exception:
print(exception.arg)
# This works
Foo.amethod(Foo())
# This should too?
Foo.astatic()