Anki
- Desiderata:
- Cards should be able to show:
- Code snippets.
- Images (ideally .tex, .svg formats).
- Video/GIFs.
- Audio.
- Fill in the blank questions.
- Multiple Choice questions.
- Choosing 1 answer questions.
- Ability to show references within the card itself.
- Tagging
- Topics :machinelearning:bayesianexperimentaldesign:neuralnetworks:bayesianoptimization:statespacemodels:stochasticcalculus:
- Textbook definitions, theorems etc. :textbook:definition:
- Textbook (general questions) :textbook:
- Textbook exercises (may want to not upload these) :textbook:exercise:
- Normal book (typically a book without exercises, but Lenny's theoretical minimum series crosses this boundary) :book:
- Youtube content/Online conference tutorials etc (use that citation generator to cite as well) :video:
- Online website/blog content (again use the citation generator) :website:
- Courses (make citation if course material available online) :course:xxxnnnmmmmuniversityname:nameofcourse:
- Paper (anything with a DOI) :paper:
- Code snippets :code:
- Cards should be able to show:
How can you check all the pip
packages installed in the current Python environment? python pip
pip list
.
How can you check the latest version of pip
packages? python pip
pip list -o
.
Describe what __name__ = __main__
does in Python. python
Suppose we have the following 2 .py
files:
# module_1.py print(f"Name of first module is {__name__}\n") def some_function(): print(f"Output of function in module {__name__}\n") if __name__ == __main__: some_function()
# module_2.py import module_1 print(f"Name of second module is {__name__}\n")
Running python module_1.py
will give:
Name of the first module is __main__ Output of function in module __main__
Running python module_2.py
will give:
Name of the first module is module_1 Name of the second module is __main__
Key ideas:
- The
__name__
variable of the Python file being executed is always__main__
. - Importing
module_1
inmodule_2.py
executes the code inmodule_1.py
. - Having the checking for
__name__ == __main__
is a good way to let others know that the file is meant to be executed, unlike a file that may only have class and function definitions.
This example is from this video.
TODO Make the code blocks run by making them share the same runtime.
What is the difference between conda
, pip
, virtualenv
, and venv
? python
pip
is a package manager for Python, used to install and manage Python packages.virtualenv
,venv
are Python environment managers, often used to isolate dependencies per project. For e.g. two projects may require 2 versions of the same Python package - having a separate Python environment for each project enables the installation of 2 versions in different environments.conda
handles both package management and environment management together. It is also not restricted to just Python packages.