@djangoproject · Post #585 · 23.03.2018 г., 02:43
https://www.fullstackpython.com/celery.html #Celery is a task #queue implementation for Python web applications used to #asynchronously execute work outside the HTTP request-response cycle.
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #60 · 31 мар.
Вторая по частоте future-функция, которую я использовал, это абсолютный импорт from __future__ import absolute_import Что она делает? Изменения, которые вносит эта инъекция описаны в PEP328 Покажу простой пример. Допустим, есть такой пакет: /my_package /__init__.py /main.py /string.py Смотрим код в my_package/main.py # main.py import string Простой пример готов) Вопрос в том, какой модуль импортируется в данном случае? Есть два варианта: 1. модуль в моём пакете my_package.string 2. стандартный модуль string И вот тут вступает в дело приоритет импортов. В Python2 порядок следующий: помимо иных источников, раньше ищется модуль внутри текущего пакета, а потом в стандартных библиотеках. Таким образом мы импортнём my_package.string. Но в Python3 это поведение изменилось. Если мы указываем просто имя пакета, то ищется именно такой модуль, игнорируя имена в текущем пакете. Если мы хотим импортнуть именно подмодуль из нашего пакета то, мы должны теперь явно это указывать. from my_package import string или относительный импорт, но с указанием пути относительно текущего модуля main from . import string Еще одной неоднозначностью меньше 😎 Подробней про импорты здесь: https://docs.python.org/3/tutorial/modules.html #2to3#pep#basic
Пребарај: #asynchronously
@djangoproject · Post #585 · 23.03.2018 г., 02:43
https://www.fullstackpython.com/celery.html #Celery is a task #queue implementation for Python web applications used to #asynchronously execute work outside the HTTP request-response cycle.
Hashtags
@djangoproject · Post #262 · 16.02.2017 г., 07:24
http://masnun.com/2015/11/20/python-asyncio-future-task-and-the-event-loop.html On any platform, when we want to do something #asynchronously, it usually involves an #event loop. An event loop is a loop that can register #tasks to be executed, execute them, delay or even cancel them and handle different events related to these operations. Generally, we #schedule multiple async functions to the event loop. The loop runs one function, while that function waits for #IO, it pauses it and runs another. When the first function completes IO, it is resumed. Thus two or more functions can #co_operatively run together. This the main goal of an event loop.