Re: [Python-Dev] Idea: Dictionary references

2015-12-18 Thread Franklin? Lee
On Fri, Dec 18, 2015 at 2:32 PM, Andrew Barnert via Python-Dev wrote: > (Also, either way, it seems more like a thread for -ideas than -dev...) I said this early on in this thread! Should I try to write up my idea as a single thing, instead of a bunch of responses, and post it in -ideas? Shoul

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Guido van Rossum
Using an Event is slightly better because you just wait for it -- you don't have to catch an exception. It's just not one of the better-known parts of asyncio. On Fri, Dec 18, 2015 at 1:42 PM, Andrew Barnert wrote: > On Friday, December 18, 2015 1:09 PM, Guido van Rossum > wrote: > > > >I guess

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Andrew Barnert via Python-Dev
On Friday, December 18, 2015 1:09 PM, Guido van Rossum wrote: >I guess we could make the default arg to sleep() 1e9. Or make it None and >special-case it. I don't feel strongly about this -- I'm not sure how baffling >it would be to accidentally leave out the delay and find your code sleeps >

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Szieberth Ádám
> I guess we could make the default arg to sleep() 1e9. Or make it None and > special-case it. By writing the OP, I considered suggesting this approach and rejected. I would have suggest the using Ellipsis (`...`) for the special case which seemed to explain more what is done plus it can hardly

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Szieberth Ádám
> Maybe you can help by submitting a patch that prevents this error! Are you > interested? I'd be honored. Ádám (http://szieberthadam.github.io/) P.S.: Was thinking about a longer answer but finally I ended up with this one :) ___ Python-Dev mailing li

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Szieberth Ádám
Thanks for your reply Andrew! > Personally I don't feel the need for `wait_forever()` or > `loop.creae_context_task()`. > > But even if you need it you may create it from scratch easy, isn't it? Indeed. I was prepared for such opinions which is OK. It is better to think it through several times

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Guido van Rossum
On Fri, Dec 18, 2015 at 12:45 PM, Andrew Barnert wrote: > On Dec 18, 2015, at 10:36, Guido van Rossum wrote: > > On Fri, Dec 18, 2015 at 10:25 AM, Szieberth Ádám > wrote: > >> Thanks for your reply Guido! >> >> > - In theory, instead of waiting for a Future that is cancelled by a >> > handler,

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Andrew Barnert via Python-Dev
On Dec 18, 2015, at 10:36, Guido van Rossum wrote: > >> On Fri, Dec 18, 2015 at 10:25 AM, Szieberth Ádám wrote: >> Thanks for your reply Guido! >> >> > - In theory, instead of waiting for a Future that is cancelled by a >> > handler, you should be able to use asyncio.sleep() with a very large n

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Andrew Barnert via Python-Dev
On Dec 18, 2015, at 10:25, Szieberth Ádám wrote: > >> - In theory, instead of waiting for a Future that is cancelled by a >> handler, you should be able to use asyncio.sleep() with a very large number >> (e.g. a million seconds). > > I was thinking on this too but it seemed less explicit to me t

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Guido van Rossum
No, it just means Windows users should not try to catch signals on Windows. Signals don't really exist there, and the simulation supporting only a few signals is awful (last I tried ^C was only processed when the process was waiting for input from stdin, and I had to use the BREAK key to stop runa

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Glenn Linderman
On 12/18/2015 10:36 AM, Guido van Rossum wrote: I was opted to the signal module because `signal` documentation suggest that it alos supports Windows while asyncio documentation states that `loop. add_signal_handler()` is UNIX only. Unfortunately that's true, but using the

Re: [Python-Dev] Idea: Dictionary references

2015-12-18 Thread Andrew Barnert via Python-Dev
> On Dec 18, 2015, at 04:56, Steven D'Aprano wrote: > >>> On Thu, Dec 17, 2015 at 09:30:24AM -0800, Andrew Barnert via Python-Dev >>> wrote: >>> On Dec 17, 2015, at 07:38, Franklin? Lee >>> wrote: >>> >>> The nested dictionaries are only for nested scopes (and inner >>> functions don't create

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Guido van Rossum
On Fri, Dec 18, 2015 at 10:25 AM, Szieberth Ádám wrote: > Thanks for your reply Guido! > > > - Instead of calling signal.signal() yourself, you should use > > loop.add_signal_handler(). It makes sure your signal handler doesn't run > > while another handler is already running. > > I was opted to

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Szieberth Ádám
Thanks for your reply Guido! > - Instead of calling signal.signal() yourself, you should use > loop.add_signal_handler(). It makes sure your signal handler doesn't run > while another handler is already running. I was opted to the signal module because `signal` documentation suggest that it alos

Re: [Python-Dev] Typo in PEP-0423

2015-12-18 Thread Guido van Rossum
On Fri, Dec 18, 2015 at 9:34 AM, Tim Legrand wrote: > Well, this looks like a rhetorical question :) > It wasn't, I was hoping you'd be quicker at picking one than me (I don't publish packages on PyPI much myself so the docs all look like Greek to me :-). > As I am totally new to Python packag

Re: [Python-Dev] Typo in PEP-0423

2015-12-18 Thread Tim Legrand
Well, this looks like a rhetorical question :) As I am totally new to Python packaging and publication, I had no precise idea of what I should get from this link. So my guess would be https://docs.python.org/2/distutils/packageindex.html (since I was expecting Python 2.7 resources, not 3.x, but I

[Python-Dev] Summary of Python tracker Issues

2015-12-18 Thread Python tracker
ACTIVITY SUMMARY (2015-12-11 - 2015-12-18) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open5324 (+27) closed 32341 (+38) total 37665 (+65) Open issues wit

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread R. David Murray
On Fri, 18 Dec 2015 18:29:35 +0200, Andrew Svetlov wrote: > I my asyncio code typical initialization/finalization procedures are > much more complicated. > I doubt if common code can be extracted into asyncio. > Personally I don't feel the need for `wait_forever()` or > `loop.creae_context_task()

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Guido van Rossum
I agree with Andrew that there are too many different scenarios and requirements to make this a useful library function. Some notes on the actual code you posted: - Instead of calling signal.signal() yourself, you should use loop.add_signal_handler(). It makes sure your signal handler doesn't run

Re: [Python-Dev] Typo in PEP-0423

2015-12-18 Thread Guido van Rossum
Which of the top links of this query do you think it should be? https://www.google.com/search?q=registering+with+the+package+index+site%3Apython.org&ie=utf-8&oe=utf-8 On Fri, Dec 18, 2015 at 3:51 AM, Tim Legrand wrote: > Hi guys, > > It's said on the Python repos page t

Re: [Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Andrew Svetlov
I my asyncio code typical initialization/finalization procedures are much more complicated. I doubt if common code can be extracted into asyncio. Personally I don't feel the need for `wait_forever()` or `loop.creae_context_task()`. But even if you need it you may create it from scratch easy, isn't

Re: [Python-Dev] pypi simple index

2015-12-18 Thread Carlos Barera
Thanks Rob! On Thu, Dec 17, 2015 at 7:36 PM, Robert Collins wrote: > > > On 18 December 2015 at 06:13, Carlos Barera > wrote: > >> Hi, >> >> I'm using install_requires in setup.py to specify a specific package my >> project is dependant on. >> When running python setup.py install, apparently

[Python-Dev] Asynchronous context manager in a typical network server

2015-12-18 Thread Szieberth Ádám
Hi Developers! This is my first post. Please excuse me my poor English. If anyone is interested, I wrote a small introduction on my homepage. Link is at the bottom. This post is about how to effectively implement the new asynchronous context manager in a typical network server. I would appreciat

[Python-Dev] Typo in PEP-0423

2015-12-18 Thread Tim Legrand
Hi guys, It's said on the Python repos page that this mailing list is the official maintainer of the peps repo , so here I am writing my question. There's is a typo in the PEP-0423 description, in which it is said: "See Registering with the P

Re: [Python-Dev] Idea: Dictionary references

2015-12-18 Thread Steven D'Aprano
On Thu, Dec 17, 2015 at 09:30:24AM -0800, Andrew Barnert via Python-Dev wrote: > On Dec 17, 2015, at 07:38, Franklin? Lee > wrote: > > > > The nested dictionaries are only for nested scopes (and inner > > functions don't create nested scopes). Nested scopes will already > > require multiple look