-
Notifications
You must be signed in to change notification settings - Fork 0
/
making_copies.txt
60 lines (43 loc) · 1.56 KB
/
making_copies.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#copy
#deepcopy
#import, from
#pacjakes:
multiple files with multiple function
some of them are shared. main functionality
package_name/
__init__.py #can be an empty file.
python_file.py #Animal
sub_package_name/
__init__.py
python_file.py
from package_name.python_file import Animal
from package_name.sub_package_name.python_file import Other_animal
OOPS:
Object oriented programing
->inheritance : ability build something and add to to it in the child classes
->abstraction : ability to manage the scope of the attributes and methods in your class.
->encapsulation : encapsulates the content and methods of the instance(object) into one single entity
->polymorphism: operator over loading is an example. add gets called when + is used.
-> overloading and overriding:
overloading :
def add(*args):
if len(args) == 2:
pass
else:
pass
overriding: def eat(self):
self.hunt()
selt.ate = True
self.hungry = False
scopes:
everything is public.
#name mangling.
def __my_private_method():
__private_var = []
conventsion _private_method _private_var
syntax:
class Animal(parentClass):
"""doc strings will be available as __doc__"""
class Animal:
class Animal(Object): #starting with python 3.0 this is not required
"self" this is equvivalent to "this" keyword in some languages.