From e68bf145bce6386972777745205d362f6e6d3f27 Mon Sep 17 00:00:00 2001 From: Harry Moreno Date: Thu, 20 Oct 2016 17:08:44 -0400 Subject: 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 --- python3.html.markdown | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'python3.html.markdown') 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 -- cgit v1.2.3