mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
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
This commit is contained in:
parent
1d2a910fd6
commit
e68bf145bc
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user