2021-01-11 10:31:34 +03:00
|
|
|
class Foo():
|
|
|
|
def amethod():
|
|
|
|
print("If this were Python, I'd be impossible to call.")
|
|
|
|
@staticmethod
|
|
|
|
def astatic():
|
2021-01-23 13:30:07 +03:00
|
|
|
print("these are special now")
|
2021-01-11 10:31:34 +03:00
|
|
|
|
|
|
|
# This doesn't work because amethod is unbound and needs an instance.
|
|
|
|
try:
|
|
|
|
Foo.amethod()
|
|
|
|
except:
|
|
|
|
print(exception.arg)
|
|
|
|
# This works
|
|
|
|
Foo.amethod(Foo())
|
|
|
|
# This should too?
|
|
|
|
Foo.astatic()
|
|
|
|
|
|
|
|
|