diff options
author | Harry Moreno <morenoh149@gmail.com> | 2016-10-20 17:08:44 -0400 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2016-10-20 23:08:44 +0200 |
commit | e68bf145bce6386972777745205d362f6e6d3f27 (patch) | |
tree | e6aaef93f82f0db68de88ec0b06c6bea4034dd4e | |
parent | 1d2a910fd68c1714215f847ea15ceb0422ec034e (diff) |
Add python3 class notes (#2479)
* explain that you can place the human and bat classes into seperate
files
* explain how to import specific functions from other files
-rw-r--r-- | python3.html.markdown | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/python3.html.markdown b/python3.html.markdown index 43e90299..9ce7790b 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -765,8 +765,13 @@ if __name__ == '__main__': print(b.say('hello')) print(b.fly) +# To take advantage of modularization by file you could place the classes above in their own files, +# say, human.py and bat.py +# to import functions from other files use the following format # from "filename-without-extension" import "function-or-class" + +# superhero.py from human import Human from bat import Bat |