Python cheat sheet 2
Well, actually I already has a blog on python cheat sheet, but I found that writing those code in gists make loading time of the page unbearable long. So I decided to put the python notes into plain markdown.
x is a subsequence of
def isSubsequence(x, s): it = iter(s) return all(c in it for c in x)
- Int: in python3, the plain
inttype is unbounded.
Global interpreter lock (GIL):
- The mechanism used by the CPython interpreter to assure that only one thread executes Python bytecode at a time. https://docs.python.org/3/glossary.html#term-global-interpreter-lock
- thread间通信，one thread signals an event and other threads wait for it.