reformat + change name
This commit is contained in:
1 parent
4f8830ab5f
commit
cb493759a0
5 files changed
+34
-27
No files matched your search
@@ -1,7 +0,0 @@
|
||||
# python prerequisites
|
||||
|
||||
python is a programming language
|
||||
|
||||
## jupyter support
|
||||
|
||||
might convert py to ipynb later
|
||||
@@ -0,0 +1,9 @@
|
||||
# python prerequisites
|
||||
|
||||
python is a programming language
|
||||
|
||||
you can read the tutorials (and load them to your device!) if you never used python
|
||||
|
||||
## jupyter support
|
||||
|
||||
for the purpose of math i use jupyter it is also better than plain py files if you are doing math
|
||||
@@ -703,6 +703,7 @@ def lda_print_example_arg(inst):
|
||||
print("instance:", inst.lda_example_instance_arg)
|
||||
print("class:", inst.lda_example_class_arg)
|
||||
|
||||
|
||||
# @classmethod # class methods passes class as opposed of instance for first arg # i just knew this!
|
||||
# def cls_print_example_arg(cls):
|
||||
# print("class:", cls.lda_example_class_arg)
|
||||
|
||||
+23
-19
@@ -6,7 +6,7 @@
|
||||
"source": [
|
||||
"# Python tutorial\n",
|
||||
"\n",
|
||||
"this is a python tutorial in jupyter notebook! this will serve as a continuation of that last one."
|
||||
"this is a python tutorial in jupyter notebook! this will serve as a continuation of that last one.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -17,7 +17,7 @@
|
||||
"\n",
|
||||
"ok mr complainer here we go:\n",
|
||||
"\n",
|
||||
"### basic"
|
||||
"### basic\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -39,7 +39,7 @@
|
||||
"source": [
|
||||
"above is an interactive piece of code. you will press run and it will remember.\n",
|
||||
"\n",
|
||||
"If you didnt press run this one will show error:"
|
||||
"If you didnt press run this one will show error:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -74,7 +74,7 @@
|
||||
"\n",
|
||||
"list, dict, set is mutable, \n",
|
||||
"dict keys and set items are unique, \n",
|
||||
"index list and tuple by index and dict by keys."
|
||||
"index list and tuple by index and dict by keys.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -111,7 +111,7 @@
|
||||
"source": [
|
||||
"### function\n",
|
||||
"\n",
|
||||
"function is declared with `def`:"
|
||||
"function is declared with `def`:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -128,7 +128,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"you can violate type hints:"
|
||||
"you can violate type hints:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -156,7 +156,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### control flow, conditional"
|
||||
"### control flow, conditional\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -238,7 +238,7 @@
|
||||
"\n",
|
||||
"exceptions are python errors. you can let it crash, catch with try except, or raise one yourself.\n",
|
||||
"\n",
|
||||
"Some common ones are `ValueError` `TypeError` and `OSError` type shit"
|
||||
"Some common ones are `ValueError` `TypeError` and `OSError` type shit\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -259,7 +259,7 @@
|
||||
"source": [
|
||||
"### class\n",
|
||||
"\n",
|
||||
"class. methods. backbone of python."
|
||||
"class. methods. backbone of python.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -306,7 +306,7 @@
|
||||
"for a function in a class it would be marked a classmethod (`@classmethod`) and with classmethods the instance get passed in first arg.\n",
|
||||
"`@staticmethod` used in the class block revert this behavior.\n",
|
||||
"\n",
|
||||
"check the tutorial.py file im lazy"
|
||||
"check the tutorial.py file im lazy\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -353,7 +353,7 @@
|
||||
"collection = [something, something_else,]\n",
|
||||
"def function(x) -> y: ...\n",
|
||||
"\n",
|
||||
"new_collection = map(function, collection) \n",
|
||||
"new_collection = map(function, collection)\n",
|
||||
"# => each x you run function on it and it returns y.\n",
|
||||
"# put that y in the place x would be in the new_collection\n",
|
||||
"\n",
|
||||
@@ -370,7 +370,9 @@
|
||||
"\n",
|
||||
"remember map and filter doesnt return a list back but a special generator object so you would have to call list() on it to use as list.\n",
|
||||
"\n",
|
||||
"why? for performance. generator is lazy."
|
||||
"why? for performance. generator is lazy.\n",
|
||||
"\n",
|
||||
"what the fuck is a generator? well i aint explaining that one. keyword: `yield`.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -383,7 +385,7 @@
|
||||
"\n",
|
||||
"comprehension. fuck do i know what it means. you dont know half these words and so do i.\n",
|
||||
"\n",
|
||||
"a simple way to do fiter_map ig"
|
||||
"a simple way to do fiter_map ig\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -408,19 +410,21 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"its: \n",
|
||||
"its:\n",
|
||||
"\n",
|
||||
"```python\n",
|
||||
"something(vals) for vals in collection if condition(vals) if condition2(vals) if etc.\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"and `something(vals)` could well be another comprehension.\n",
|
||||
"\n",
|
||||
"notice for in if. strictly for in if, and not if for in. that if is of something else.\n",
|
||||
"notice: `for in if`. **strictly** for in if, and not if for in. that if is of something else.\n",
|
||||
"\n",
|
||||
"oh but `something if condition else something_else` i also see how is that\n",
|
||||
"oh but `something if condition else something_else` i also see that what about that\n",
|
||||
"\n",
|
||||
"well that is another shorthand unrelated, but if you can use sure go ahead\n",
|
||||
"well that is another shorthand unrelated to this one, but if you can use sure go ahead\n",
|
||||
"\n",
|
||||
"its kinda like the Ternary conditional operator `cond ? true_expr : false_expr` in c or typescript and yes you can go crazy with it just like with typescript"
|
||||
"its kinda like the Ternary conditional operator `cond ? true_expr : false_expr` in c or typescript and yes you can go crazy with it just like with typescript\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -474,7 +478,7 @@
|
||||
"\n",
|
||||
"so numpy dont use python types. numpy uses its own types. its own functions. almost all of them not from python but from C for all the speed\n",
|
||||
"\n",
|
||||
"try ctrl space the just imported np object. snoop around. its complicated. theres so much. we dont use much of it tho."
|
||||
"try ctrl space the just imported np object. snoop around. its complicated. theres so much. we dont use much of it tho.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user