summaryrefslogtreecommitdiff
path: root/Technology/Python.md
diff options
context:
space:
mode:
Diffstat (limited to 'Technology/Python.md')
-rw-r--r--Technology/Python.md65
1 files changed, 0 insertions, 65 deletions
diff --git a/Technology/Python.md b/Technology/Python.md
deleted file mode 100644
index bc08ed2..0000000
--- a/Technology/Python.md
+++ /dev/null
@@ -1,65 +0,0 @@
-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)
-with no arg show you all name in global namespace
-
-dir() == sorted(globals().keys())
-
-gloabls() == locals()
-
-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
-
-
-1st time you import a modules python execute the code inside it.
-2nd time will not re-run the code. (usefull when import multiples modules that import all the same modules)
-importlib if want to reload modules so run more than once
-
-When importing a module you can use it's defined functions, classes, constants etc...
-Access those thing by putting the module name as prefix before the function
-
-import X
-import X as x
-from X import x
-from X import x as x
-
-when you run a modules as a script __ name__ becomes __ main__
-
-
-__ init__.py - required to tell python dir is a pkg (initialise a pkg) REQUIRED
-used to set the __ all__ variable & import submodules
-
-
-