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 [2014/01/22 15:28] – 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:// | * [[https:// | ||
* [[http:// | * [[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 238: | Line 243: | ||
import inspect | import inspect | ||
# Maybe use os.path.abspath(__file__) ? | # Maybe use os.path.abspath(__file__) ? | ||
- | with open( os.path.abspath( inspect.getfile( inspect.currentframe() ) ), ' | + | with open(os.path.abspath inspect.getfile(inspect.currentframe())), |
try: | try: | ||
- | fcntl.flock( f, fcntl.LOCK_EX ) | + | fcntl.flock(f, |
call_that_cannot_be_concurrent() | call_that_cannot_be_concurrent() | ||
finally: | finally: | ||
- | fcntl.flock( f, fcntl.LOCK_UN ) | + | 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