Skip to content

Latest commit

 

History

History

README.md

Basic templates for Python

builtin.py

Frequently used built-in modules.

common_dsalg.py

Containing some common data structure & algorithm implemented with built-in functionality/code/lib. Frequently used in leetcode practice.

  • use iterator to save memory.

  • itertools: permuation, combination, product. realpython blog

  • formatting string with f-string.

  • operators: call basic operators as functions.

  • common data structures


arg_parser.py


decorators.py

My notes

  • high-order function: a function that returns a function.
  • decorator: a function that takes a function input, calls this function in an created inner(wrapper) function and returns the inner function, or directly return the function.
  • When we want a decorator to receive arguments, we define it as a fuction that returns a decorator function.
  • decorators could also be callble objects. This has similarity with React Components where we have function component and class component. python decorator could be a callable class, so it could store states.
  • how we fix the definition: decorator: a functioncallable object that takes a function input, calls this function in an created inner function and returns the inner function, or directly return the function.

plot.py

My templates for drawing plots with matplotlib.


test.py

RealPython blog python -m unittest discover -s tests

RealPython blog


execl.py

anti_patterns.py

things we should avoid.


Templates for Applications

db_manager.py