Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
As of version 3.3, python includes the very promising concurrent.futures
module, with elegant context managers for running tasks concurrently. Thanks to the simple and consistent interface you can use both threads and processes with minimal effort.
For most CPU bound tasks - anything that is heavy number crunching - you want your program to use all the CPUs in your PC. The simplest way to get a CPU bound task to run in parallel is to use the ProcessPoolExecutor, which will create enough sub-processes to keep all your CPUs busy.
We use the context manager thusly:
with concurrent.futures.ProcessPoolExecutor() as executor:
Во-первых, это моё мнение, и я его никому не навязываю. Во-вторых, список не обязательно исчерпывающий. В-третьих, он ориентирован на определённую "философию", которая тоже не является исчерпывающей или абсолютно правильной. Поэтому, если Вам эти рекомендации не подходят -- не следуйте им.
Философия такова. Для того чтобы осмысленно программировать на начальном этапе не нужно знать Computer Science, теорию алгоритмов и сложности вычислений или детально разбираться в устройстве и работе компьютера. Достаточно хорошо делать две вещи:
========================= | |
Join promotion in the ORM | |
========================= | |
[NOTE: We need better terms than promote and demote for changing the join | |
type. These terms are extremely easy to mix up. Maybe the ORM methods could | |
be to_inner_joins and to_louter_joins instead of promote_joins and demote_joins? | |
I tried to clean up the mis-usages of promotion/demotion but there could still | |
be some cases where these are mixed up] |
group: bank example | |
description[[ the data for this dataset was generated using <http://www.generatedata.com/> | |
* the relation _Customers_ contains basic information about the customers of the bank. | |
* the relation _Accounts_ contains the basic information of a single account. Note that a customer can have any number of accounts. | |
* the relation _PremiumCustomers_ contains the customer-ids of all customers with a total balance over 1000 | |
]] | |
Customers = { cid firstname lastname |
Good article also here: http://pankrat.github.io/2015/django-migrations-without-downtimes/
The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.
Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.