diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2022-01-17 19:47:01 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2022-01-17 19:47:01 +0000 |
commit | 06ec17c5e65d03ffd14a60ce89fe71234eb81c8a (patch) | |
tree | 89f52069d6b39b387f8644cd83a4f70c02180e58 /ExampleSubmission | |
parent | 37236fdc957f5900f6a4bbffbff6ccc07d412c44 (diff) | |
download | Smarker-06ec17c5e65d03ffd14a60ce89fe71234eb81c8a.tar.gz Smarker-06ec17c5e65d03ffd14a60ce89fe71234eb81c8a.zip |
added getting class inheritance tree, getting method args nicely, fixed bug with importing too many modules
Diffstat (limited to 'ExampleSubmission')
-rw-r--r-- | ExampleSubmission/animals.py | 22 | ||||
-rw-r--r-- | ExampleSubmission/example.py | 11 |
2 files changed, 32 insertions, 1 deletions
diff --git a/ExampleSubmission/animals.py b/ExampleSubmission/animals.py new file mode 100644 index 0000000..10c1cb4 --- /dev/null +++ b/ExampleSubmission/animals.py @@ -0,0 +1,22 @@ +import datetime + +class Animal: + def __init__(self): + self.birthday = datetime.datetime.now() + + def move(self): + return "*moves*" + +class Dog(Animal): + def speak(self): + return "woof" + +class Cat(Animal): + def speak(self): + return "meow" + +class Kitten(Cat): + """nyaa~~~ + """ + def speak(self): + return "meow (but cuter)" diff --git a/ExampleSubmission/example.py b/ExampleSubmission/example.py index b64c98d..a226adb 100644 --- a/ExampleSubmission/example.py +++ b/ExampleSubmission/example.py @@ -1,3 +1,6 @@ +# Eden Attenborough +# 12-01-21 + import tkinter as tk class Application(tk.Tk): @@ -8,7 +11,7 @@ class Application(tk.Tk): self.title("Hello World!") - def a_method_with_defaults(self, arg_1 = "hello", arg_2 = "world"): + def a_method_with_defaults(self, n:str, arg_1 = "hello", arg_2 = "world", count:int = 3): """Adds two strings together with a space between them. Args: @@ -32,6 +35,7 @@ class Application(tk.Tk): """ return num1 + num2 +# hello world! def hello_world(times): """Prints 'hello world!' to stdout. Prints it out `times` times. @@ -46,6 +50,11 @@ def hello_world(times): def an_undocumented_function(): return 3.14156 +# kwonlyargs demo +def greet(*names, greeting="Hello"): + for name in names: + print(greeting, name) + if __name__ == "__main__": app = Application() app.mainloop()
\ No newline at end of file |