Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python.announce > #2572
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Michele Simionato <michele.simionato@gmail.com> |
| Newsgroups | comp.lang.python.announce |
| Subject | decorator 4.1 is out |
| Date | Sat, 15 Jul 2017 06:33:08 -0700 (PDT) |
| Lines | 42 |
| Approved | python-announce-list@python.org |
| Message-ID | <mailman.115.1500294005.29743.python-announce-list@python.org> (permalink) |
| References | <4ac8d3f7-493b-4d90-b63f-98b27d2dc37c@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | news.uni-berlin.de 1vSHUpBwBefmZQhaTYR4KANLlTRP+HjGE6GrP2X6u87w== |
| X-Orig-Path | v31no729634qtb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Return-Path | <news@google.com> |
| X-Original-To | python-announce@python.org |
| Delivered-To | python-announce-list@mail.python.org |
| X-Spam-Status | OK 0.014 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'url:pypi': 0.03; 'received:209.85.223': 0.03; '__name__': 0.05; 'url:github': 0.05; '*args,': 0.07; 'python': 0.09; "'__main__':": 0.09; 'args)': 0.09; 'tracing': 0.09; 'def': 0.13; 'args,': 0.16; 'async': 0.16; 'debugging:': 0.16; 'time.time()': 0.16; 'skip:g 40': 0.18; 'output': 0.18; 'all,': 0.22; 'decorator': 0.22; 'instance,': 0.22; 'this:': 0.24; 'url:io': 0.24; 'module': 0.24; 'import': 0.26; 'header:User-Agent:1': 0.26; 'logging': 0.27; 'skip:l 30': 0.28; 'seconds': 0.29; 'example': 0.29; '**kwargs)': 0.29; '**kwargs):': 0.29; 'download:': 0.29; 'project:': 0.29; 'skip:[ 10': 0.31; 'url:python': 0.31; 'received:google.com': 0.32; 'implement': 0.32; 'hosted': 0.33; '3.5': 0.33; 'url:en': 0.34; 'release': 0.34; 'received:209.85': 0.36; 'url:org': 0.36; 'received:209': 0.38; 'proto:https': 0.39; 'received:io': 0.39; 'received:psf.io': 0.39; 'received:ams1.psf.io': 0.40; 'received:mail1.ams1.psf.io': 0.40; 'called': 0.40; 'received:net': 0.60; 'dear': 0.64; 'to:addr:comp-lang-python- announce': 0.66; 'here': 0.66; 'url:index': 0.69; 'url:4': 0.73; 'received:130': 0.73; 'await': 0.76; 'to:addr:moderators.isc.org': 0.76; 'received:130.133': 0.79; 'received:130.133.4': 0.79; 'received:130.133.4.7': 0.79; 'received:individual.net': 0.79; 'received:moderators.individual.net': 0.79; '@decorator': 0.84; 'links:': 0.84; 'message-id:@googlegroups.com': 0.93 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:path:newsgroups:date:complaints-to :injection-info:nntp-posting-host:user-agent:mime-version:message-id :subject:from:injection-date:to; bh=/Egpt+F05RKr32YqKfHycDtC4CpD/jojkqVXBJC3otM=; b=R3l+On6YpcKM+oo5fZsh0cdvo+5/uUw4wQEaWuCxah409ff/tucfgfGB1hd7UXpv1s dxYAmRpToOPUByFsVXzZ3FTMMv3gkR9w6i1W4Un+p/escthFJ3OWtCh/Jn3zJGpV2+Lf 4vFLCRiFBJCkfn9KiVlLWAsPXMz87d9ownp1Ro+Vj40ahnzqUURm7Bptt/G/z6ONLGGV 0mfJ+doNtOsevpVy1mxeHesQNfmGp1aAPYx1oUS/eWtHlFfNeScOWUijI/7CYsvcnZn8 0YtMYrdvz6h4Yq+IyIPVpIvJgNwfgxPZQQkWwQwWn4fddC+ZOe/YJHM+g6Dh4i3ymHih +clA== |
| X-Gm-Message-State | AIVw111xTryNFZCroD82oecMtQkUjGzISz0qtLvCBqZrrzXa3rG5mKlD vMXXqqxykqsHBRVZEWGl0JHIWWBsw31bwGJfsuo= |
| X-Received | by 10.107.170.158 with SMTP id g30mr9061873ioj.95.1500125589428; Sat, 15 Jul 2017 06:33:09 -0700 (PDT) |
| X-Received | by 10.31.69.77 with SMTP id s74mr47984vka.1.1500125589265; Sat, 15 Jul 2017 06:33:09 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=2.225.185.4; posting-account=gxxH8QkAAABVKeYyAqGOGoaFtdDdsshI |
| User-Agent | G2/1.0 |
| Injection-Date | Sat, 15 Jul 2017 13:33:09 +0000 |
| X-Mailman-Approved-At | Mon, 17 Jul 2017 08:20:04 -0400 |
| X-BeenThere | python-announce-list@python.org |
| X-Mailman-Version | 2.1.24 |
| Precedence | list |
| List-Id | Announcement-only list for the Python programming language <python-announce-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-announce-list/> |
| List-Post | <mailto:python-announce-list@python.org> |
| List-Help | <mailto:python-announce-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <4ac8d3f7-493b-4d90-b63f-98b27d2dc37c@googlegroups.com> |
| Xref | csiph.com comp.lang.python.announce:2572 |
Show key headers only | View raw
Dear all,
a new release of the decorator module is out. For the first time we support decorating Python 3.5 coroutines. For instance, this is an example of how to implement a tracing decorator called log_start_stop that you can use for debugging:
import time
import logging
from asyncio import get_event_loop, sleep, wait
from decorator import decorator
@decorator
async def log_start_stop(coro, *args, **kwargs):
logging.info('Starting %s%s', coro.__name__, args)
t0 = time.time()
await coro(*args, **kwargs)
dt = time.time() - t0
logging.info('Ending %s%s after %d seconds', coro.__name__, args, dt)
@log_start_stop
async def make_task(n):
for i in range(n):
await sleep(1)
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
tasks = [make_task(3), make_task(2), make_task(1)]
get_event_loop().run_until_complete(wait(tasks))
You will get an output like this:
INFO:root:Starting make_task(1,)
INFO:root:Starting make_task(3,)
INFO:root:Starting make_task(2,)
INFO:root:Ending make_task(1,) after 1 seconds
INFO:root:Ending make_task(2,) after 2 seconds
INFO:root:Ending make_task(3,) after 3 seconds
Also, for the first time the documentation is hosted on readthedocs.org.
Here are the relevant links:
Download: https://pypi.python.org/pypi/decorator/4.1.1
Project: https://github.com/micheles/decorator/
Docs: http://decorator.readthedocs.io/en/latest/index.html
Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread
decorator 4.1 is out Michele Simionato <michele.simionato@gmail.com> - 2017-07-15 06:33 -0700
csiph-web