Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Yury Selivanov
On Sun, Aug 13, 2017 at 3:14 PM, Nathaniel Smith wrote: > On Sun, Aug 13, 2017 at 9:57 AM, Yury Selivanov > wrote: >> 2. ContextItem.has(), ContextItem.get(), ContextItem.set(), >> ContextItem.delete() -- pretty self-explanatory. > > It might make sense to simplify even further and declare that

Re: [Python-ideas] Python-ideas Digest, Vol 129, Issue 44

2017-08-13 Thread 王宣 赵
Thank you for your consideration. 获取 Outlook for Android 发件人: python-ideas-requ...@python.org 发送时间: 8月14日星期一 03:14 主题: Python-ideas Digest, Vol 129, Issue 44 收件人: python-ideas@python.org Send Python-ideas mailing list submissions to python-ideas@python.org To subscribe

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Nathaniel Smith
On Sun, Aug 13, 2017 at 9:57 AM, Yury Selivanov wrote: > 2. ContextItem.has(), ContextItem.get(), ContextItem.set(), > ContextItem.delete() -- pretty self-explanatory. It might make sense to simplify even further and declare that context items are initialized to None to start, and the only operat

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Yury Selivanov
I'll start a new thread to discuss is we want this specific semantics change soon (with some updates). Yury ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf

[Python-ideas] How do you think about these language extensions?

2017-08-13 Thread 王宣 ?
Hi all, I've just finished a language extension for CPython 3.6.x to support some additional grammars like Pattern Matching. And It's compatible with CPython. I'm looking for constructive advice, and I wonder if you will be interested in this one. ( the project address is https://github.com/t

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Yury Selivanov
[replying to the list] On Sun, Aug 13, 2017 at 6:14 AM, Nick Coghlan wrote: > On 13 August 2017 at 16:01, Yury Selivanov wrote: >> On Sat, Aug 12, 2017 at 10:56 PM, Nick Coghlan wrote: >> [..] >>> As Nathaniel suggestion, getting/setting/deleting individual items in >>> the current context woul

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Yury Selivanov
On Sat, Aug 12, 2017 at 10:09 PM, Nick Coghlan wrote: > On 13 August 2017 at 03:53, Yury Selivanov wrote: >> On Sat, Aug 12, 2017 at 1:09 PM, Nick Coghlan wrote: >>> Now that you raise this point, I think it means that generators need >>> to retain their current context inheritance behaviour, si

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Yury Selivanov
>> This is a new PEP to implement Execution Contexts in Python. > The idea is of course great! Thanks! > A couple of issues for decimal: > >> Moreover, passing the context explicitly does not work at all for >> libraries like ``decimal`` or ``numpy``, which use operator overloading. > > Instead

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Yury Selivanov
Hi Pau, Re string keys collisions -- I decided to update the PEP to follow Nathaniel's suggestion to use a get_context_key api, which will eliminate this problem entirely. Re call_soon in asyncio.Task -- yes, it does use ec.run() to invoke coroutine.send(). However, this has almost no visible eff

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Yury Selivanov
Hi Jonathan, Thanks for the feedback. I'll update the PEP to use Nathaniel's idea of of `sys.get_context_key`. It will be a pretty similar API to what you currently have in prompt_toolkit. Yury ___ Python-ideas mailing list Python-ideas@python.org https

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Pau Freixes
Finally got an almost decent internet connection. Seeing the changes related to that PEP I can confirm that the context will be saved twice in any "task switch" in an Asyncio environment. Once made by the run in context function executed by the Handler [1] and immediately after by the send [2] met

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-13 Thread Jonathan Slenders
For what it's worth, as part of prompt_toolkit 2.0, I implemented something very similar to Nathaniel's idea some time ago. It works pretty well, but I don't have a strong opinion against an alternative implementation. - The active context is stored as a monotonically increasing integer. - For eac