djangoproject
154 subscribers
2 videos
8 files
550 links
connect with us:
@XtakjoyX
Download Telegram
https://glyph.twistedmatrix.com/2014/02/unyielding.html

As we know, #threads are a bad idea, (for most purposes). Threads make local reasoning difficult, and local reasoning is perhaps the most important thing in software development.

With the word “threads”, I am referring to shared-state multithreading, despite the fact that there are languages, like Erlang and Haskell which refer to concurrent processes – those which do not implicitly share state, and require explicit coordination – as “threads”.

#asyncio
http://wla.berkeley.edu/~cs61a/fa11/lectures/streams.html

In this chapter, we continue our discussion of real-world applications by developing new tools to process #sequential #data. In Chapter 2, we introduced a sequence interface, implemented in Python by built-in data types such as #tuple and #list. #Sequences supported two operations: querying their length and accessing an element by index. In Chapter 3, we developed a user-defined implementations of the sequence interface, the Rlist class for representing recursive lists. These sequence types proved effective for representing and accessing a wide variety of sequential #datasets.
https://docs.python.org/2/library/modulefinder.html

This #module provides a #ModuleFinder class that can be used to determine the set of modules imported by a script. modulefinder.py can also be run as a script, giving the filename of a Python script as its argument, after which a report of the imported modules will be printed.
https://wiki.python.org/moin/GlobalInterpreterLock

In #CPython, the #global #interpreter lock, or #GIL, is a mutex that prevents multiple native #threads from executing Python bytecodes at once. This lock is necessary mainly because CPython's memory management is not thread-safe. (However, since the GIL exists, other features have grown to depend on the guarantees that it enforces.)
https://docs.python.org/2/library/multiprocessing.html

#multiprocessing is a package that supports spawning processes using an #API similar to the #threading module. The multiprocessing package offers both local and remote #concurrency, effectively side-stepping the Global Interpreter Lock by using subprocesses instead of #threads. Due to this, the multiprocessing module allows the programmer to fully leverage multiple processors on a given machine. It runs on both Unix and Windows.
https://docs.python.org/3/library/atexit.html

The #atexit module defines #functions to #register and #unregister cleanup functions. Functions thus registered are automatically executed upon normal interpreter termination. atexit runs these functions in the reverse order in which they were registered; if you register A, B, and C, at #interpreter #termination time they will be run in the order C, B, A.
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world

inShare

This is the first article in a series where I will be documenting my experience writing #web_applications in Python using the #Flask microframework.
https://github.com/realpython/discover-flask/blob/master/readme.md

#Flask is a micro web #framework powered by Python. Its #API is fairly small, making it easy to learn and simple to use. But don't let this fool you, as it's powerful enough to support enterprise-level applications handling large amounts of traffic. You can start small with an app contained entirely in one file, then slowly scale up to multiple files and folders in a well-structured manner as your site becomes more and more complex.
https://www.buzzfeed.com/andrewkelleher/deep-exploration-into-python-lets-review-the-dict-module?utm_term=.rhDeZBxA8#.bgB5DM0Z9

In this series, we’ll take a look at various modules and pieces of functionality of the #Python language. We’ll look at design choices, their impact, and their evolution. We’ll also look at the design of the language itself and learn about the operations of the interpreter as it parses the language all the way to the main eval loop. Finally, we’ll attempt to give practical takeaways that fall out of a deeper understanding of the language.
The #cpython implementation of Python (which is the standard on most machines) has been ported over to GitHub from its home in Mercurial. I think it also had a time under #SVN, but the engineers managed to preserve (for the most part) the commit logs.
https://github.com/aio-libs/aiomysql

#aiomysql is a "driver" for accessing a #MySQL database from the #asyncio (PEP-3156/tulip) framework. It depends on and reuses most parts of #PyMySQL . aiomysql tries to be like awesome #aiopg library and preserve same api, look and feel.

Internally aiomysql is copy of PyMySQL, underlying io calls switched to async, basically yield from and asyncio.coroutine added in proper places)). sqlalchemy support ported from aiopg.
https://github.com/KeepSafe/aiohttp


Supports both #client and #server side of HTTP protocol.
Supports both client and server Web-Sockets out-of-the-box.
Web-server has middlewares and pluggable #routing.

Optionally you may install the #cChardet and #aiodns libraries (highly recommended for sake of speed).
https://pypi.python.org/pypi/uvloop

#uvloop is a fast, drop-in replacement of the built-in #asyncio event loop. uvloop is released under the MIT license.

uvloop and asyncio, combined with the power of async/await in Python 3.5, makes it easier than ever to write high-performance #networking code in Python.

uvloop makes asyncio fast. In fact, it is at least 2x faster than #nodejs, #gevent, as well as any other Python #asynchronous framework. The performance of uvloop-based asyncio is close to that of Go programs.
https://docs.python.org/2/library/ctypes.html

#ctypes is a foreign function library for Python. It provides #C compatible data types, and allows calling functions in #DLLs or shared libraries. It can be used to wrap these libraries in pure Python.
#signal — Set handlers for #asynchronous events

This module provides mechanisms to use signal handlers in Python.

The signal.signal() function allows to define custom handlers to be executed when a signal is received. A small number of default handlers are installed: #SIGPIPE is ignored (so write errors on pipes and sockets can be reported as ordinary Python exceptions) and #SIGINT is translated into a KeyboardInterrupt exception.

#Asyncio

https://docs.python.org/3.4/library/signal.html