Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Steve Dower
Nick: “I like Yury's example for this, which is that the following two examples are currently semantically equivalent, and we want to preserve that equivalence:     with decimal.localcontext() as ctx:     ctc.prex = 30         for i in gen():            pass     g = gen()     with decimal.lo

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Guido van Rossum
On Tue, Oct 10, 2017 at 5:34 AM, Nick Coghlan wrote: > On 10 October 2017 at 01:24, Guido van Rossum wrote: > >> On Sun, Oct 8, 2017 at 11:46 PM, Nick Coghlan wrote: >> >>> On 8 October 2017 at 08:40, Koos Zevenhoven wrote: >>> ​​I do remember Yury mentioning that the first draft of PEP 5

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Yury Selivanov
On Tue, Oct 10, 2017 at 12:34 PM, Koos Zevenhoven wrote: > On Tue, Oct 10, 2017 at 3:42 PM, Nick Coghlan wrote: [..] >> Context managers are merely syntactic sugar for try/finally statements, so >> you can't wave your hands and say a context manager is the only supported >> API: you *have* to bre

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Koos Zevenhoven
On Tue, Oct 10, 2017 at 3:42 PM, Nick Coghlan wrote: > On 10 October 2017 at 22:34, Koos Zevenhoven wrote: > >> Really, it was my mistake to ever make you think that >> context_var.assign(42).__enter__() can be compared to .set(42) in PEP >> 550. I'll say it once more: PEP 555 context arguments

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Yury Selivanov
On Tue, Oct 10, 2017 at 12:21 PM, Koos Zevenhoven wrote: [..] >> Please stop using "many things .. would", "most likely" etc. > > > I can't explain everything, especially not in a single email. I will use > whatever English words I need. You can also think for yourself––or ask a > question. I can

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Yury Selivanov
On Tue, Oct 10, 2017 at 11:26 AM, Koos Zevenhoven wrote: > On Tue, Oct 10, 2017 at 5:40 PM, Yury Selivanov > wrote: >> >> On Tue, Oct 10, 2017 at 8:34 AM, Koos Zevenhoven >> wrote: >> > On Tue, Oct 10, 2017 at 4:22 AM, Yury Selivanov >> > >> > wrote: >> >> >> >> On Mon, Oct 9, 2017 at 8:37 PM,

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Koos Zevenhoven
On Tue, Oct 10, 2017 at 5:46 PM, Yury Selivanov wrote: > On Tue, Oct 10, 2017 at 10:22 AM, Koos Zevenhoven > wrote: > > On Tue, Oct 10, 2017 at 5:01 PM, Nick Coghlan > wrote: > >> > >> On 10 October 2017 at 22:51, Koos Zevenhoven wrote: > >>> > >>> I see no reason why these two should be equiv

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Koos Zevenhoven
On Tue, Oct 10, 2017 at 5:40 PM, Yury Selivanov wrote: > On Tue, Oct 10, 2017 at 8:34 AM, Koos Zevenhoven > wrote: > > On Tue, Oct 10, 2017 at 4:22 AM, Yury Selivanov > > > wrote: > >> > >> On Mon, Oct 9, 2017 at 8:37 PM, Koos Zevenhoven > wrote: > >> > You can cause unbound growth in PEP 550

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Yury Selivanov
On Tue, Oct 10, 2017 at 10:22 AM, Koos Zevenhoven wrote: > On Tue, Oct 10, 2017 at 5:01 PM, Nick Coghlan wrote: >> >> On 10 October 2017 at 22:51, Koos Zevenhoven wrote: >>> >>> I see no reason why these two should be equivalent. >> >> >> There is no "should" about it: it's a brute fact that the

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Yury Selivanov
On Tue, Oct 10, 2017 at 8:34 AM, Koos Zevenhoven wrote: > On Tue, Oct 10, 2017 at 4:22 AM, Yury Selivanov > wrote: >> >> On Mon, Oct 9, 2017 at 8:37 PM, Koos Zevenhoven wrote: >> > You can cause unbound growth in PEP 550 too. All you have to do is nest >> > an >> > unbounded number of generators

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Koos Zevenhoven
On Tue, Oct 10, 2017 at 5:01 PM, Nick Coghlan wrote: > On 10 October 2017 at 22:51, Koos Zevenhoven wrote: > >> ​I see no reason why these two should be equivalent. >> > > There is no "should" about it: it's a brute fact that the two forms *are* > currently equivalent for lazy iterators (includi

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Nick Coghlan
On 10 October 2017 at 22:51, Koos Zevenhoven wrote: > ​I see no reason why these two should be equivalent. > There is no "should" about it: it's a brute fact that the two forms *are* currently equivalent for lazy iterators (including generators), and both different from the form that uses eager

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Koos Zevenhoven
On Tue, Oct 10, 2017 at 3:34 PM, Nick Coghlan wrote: > On 10 October 2017 at 01:24, Guido van Rossum wrote: > >> On Sun, Oct 8, 2017 at 11:46 PM, Nick Coghlan wrote: >> >>> On 8 October 2017 at 08:40, Koos Zevenhoven wrote: >>> ​​I do remember Yury mentioning that the first draft of PEP 5

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Nick Coghlan
On 10 October 2017 at 22:34, Koos Zevenhoven wrote: > Really, it was my mistake to ever make you think that > context_var.assign(42).__enter__() can be compared to .set(42) in PEP > 550. I'll say it once more: PEP 555 context arguments have no equivalent of > the PEP-550 .set(..). > Then your al

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Koos Zevenhoven
On Tue, Oct 10, 2017 at 4:22 AM, Yury Selivanov wrote: > On Mon, Oct 9, 2017 at 8:37 PM, Koos Zevenhoven wrote: > > You can cause unbound growth in PEP 550 too. All you have to do is nest > an > > unbounded number of generators. > > You can only nest up to 'sys.get_recursion_limit()' number of g

Re: [Python-ideas] PEP draft: context variables

2017-10-10 Thread Nick Coghlan
On 10 October 2017 at 01:24, Guido van Rossum wrote: > On Sun, Oct 8, 2017 at 11:46 PM, Nick Coghlan wrote: > >> On 8 October 2017 at 08:40, Koos Zevenhoven wrote: >> >>> ​​I do remember Yury mentioning that the first draft of PEP 550 captured >>> something when the generator function was calle

Re: [Python-ideas] PEP 561: Distributing Type Information V3

2017-10-10 Thread Ivan Levkivskyi
Thanks Ethan! The PEP draft now looks good to me. I think it makes sense to make a PoC implementation of the PEP at this point to see if everything works smoothly in practice. (You could also link few examples with your PoC implementation in the PEP) -- Ivan On 6 October 2017 at 22:00, Ethan