python:python
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
python:python [2013/09/28 00:55] – dblume | python:python [2022/06/15 07:49] – Mention flask gunicorn nginx dblume | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Python ====== | + | ====== |
Man, there' | Man, there' | ||
Line 7: | Line 7: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
- | * Of course, there' | + | * Of course, there' |
* There' | * There' | ||
- | * Look into the microframework [[http:// | + | * Look into the microframework [[http:// |
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * A Power Point deck by Alex Martelli describing [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
Would be nice to create a binary search in text files in Python. | Would be nice to create a binary search in text files in Python. | ||
Line 16: | Line 23: | ||
Would be good to experiment with [[http:// | Would be good to experiment with [[http:// | ||
- | |||
===== Data Analysis ===== | ===== Data Analysis ===== | ||
Line 226: | Line 232: | ||
x = property( getx, setx ) | x = property( getx, setx ) | ||
+ | </ | ||
+ | |||
+ | ====== filelock ====== | ||
+ | |||
+ | Evan Fosmark has a filelock module. | ||
+ | |||
+ | <code python> | ||
+ | import os | ||
+ | import fcntl | ||
+ | import inspect | ||
+ | # Maybe use os.path.abspath(__file__) ? | ||
+ | with open(os.path.abspath inspect.getfile(inspect.currentframe())), | ||
+ | try: | ||
+ | fcntl.flock(f, | ||
+ | call_that_cannot_be_concurrent() | ||
+ | finally: | ||
+ | fcntl.flock(f, | ||
+ | </ | ||
+ | |||
+ | ====== Various Approaches to threaded URL Requests ====== | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * Or, use the doc's [[https:// | ||
+ | * And, as mentioned in Parallelism in One Line, [[https:// | ||
+ | |||
+ | ====== Fibonacci Generator with Itertools ====== | ||
+ | |||
+ | <code python> | ||
+ | import itertools | ||
+ | |||
+ | def fib(n): | ||
+ | """ | ||
+ | a, b = 0, 1 | ||
+ | while True: | ||
+ | yield a | ||
+ | b = a + b | ||
+ | yield b | ||
+ | a = a + b | ||
+ | |||
+ | if __name__ == ' | ||
+ | for x in itertools.islice(fib(), | ||
+ | print x | ||
+ | |||
+ | # for i in range( 5 ): | ||
+ | # print i, fib( i ) | ||
</ | </ | ||
python/python.txt · Last modified: 2024/02/27 15:43 by dblume