summaryrefslogtreecommitdiff
path: root/Technology/Python.md
blob: e9e5a49e2cb0060b8c9848941de49753058cc986 (plain)
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
Python does not have a classpath and unless you are root, you can't install new pkg for the whole system

# pip installs in

.local/lib/


virtualenv - solution to pkg management? - isolated space with own instance of python

virtualenv TESTENV -p python
source TESTENV/bin/activate
# to get out of env
deactivate


** exponant

x = 'Mark'
len(x) - function
x.upper() - method

dir() - built it give directory of an object (all methods available)
super() - goes trought inheritance chain and return the class that is after the one passed as the function first argument. Can by used to bypass modification made by earlier classes.


# Data containers

list()  - []
dict()  - {}
tuple() - ()
set()   - set()



__ init__  - where to assign instance specific attributes when object first constructed
__ str__ - control how object is printed
__ repr__ - object output when interactive shell
__ eq__ - uniquely identify all created object