tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,19 @@
|
|||
class Example(object):
|
||||
def foo(self):
|
||||
print("this is foo")
|
||||
def bar(self):
|
||||
print("this is bar")
|
||||
def __getattr__(self, name):
|
||||
def method(*args):
|
||||
print("tried to handle unknown method " + name)
|
||||
if args:
|
||||
print("it had arguments: " + str(args))
|
||||
return method
|
||||
|
||||
example = Example()
|
||||
|
||||
example.foo() # prints “this is foo”
|
||||
example.bar() # prints “this is bar”
|
||||
example.grill() # prints “tried to handle unknown method grill”
|
||||
example.ding("dong") # prints “tried to handle unknown method ding”
|
||||
# prints “it had arguments: ('dong',)”
|
||||
Loading…
Add table
Add a link
Reference in a new issue