Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-24 Thread Nathaniel Smith
On Sun, Oct 23, 2016 at 11:42 PM, Armin Rigo wrote: > Hi, > > On 24 October 2016 at 06:03, hubo wrote: >> long time, which is what PyPy is for. Files may not be the most critical >> problem, the real problem is LOCK - when you use with on a lock, there

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-24 Thread Armin Rigo
Hi, On 24 October 2016 at 06:03, hubo wrote: > long time, which is what PyPy is for. Files may not be the most critical > problem, the real problem is LOCK - when you use with on a lock, there are > chances that it never unlocks. Bah. I would say that it makes the whole

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-23 Thread hubo
Aprano <st...@pearwood.info> 发送时间:2016-10-22 07:13 主题:Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators 收件人:"pypy-dev"<pypy-dev@python.org> 抄送: On Fri, Oct 21, 2016 at 10:13:45PM +0800, hubo wrote: > Well I'm really shocked to find out what I thought wa

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-23 Thread Steven D'Aprano
On Sun, Oct 23, 2016 at 01:23:25AM +0200, Armin Rigo wrote: > Hi Steven, > > On 22 October 2016 at 01:13, Steven D'Aprano wrote: > > Saving lives? That's a bit of an exaggeration, isn't it? > > > > There is a big discussion going on over on the Python-Ideas mailing > > list,

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-22 Thread Armin Rigo
Hi again, On 23 October 2016 at 01:23, Armin Rigo wrote: > then "it works fine in CPython" I forgot the usual "if you don't have references from a cycle" here. That is, it works fine in CPython unless your object graph is in some shape that is hard to predict, relatively

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-22 Thread Armin Rigo
Hi Steven, On 22 October 2016 at 01:13, Steven D'Aprano wrote: > Saving lives? That's a bit of an exaggeration, isn't it? > > There is a big discussion going on over on the Python-Ideas mailing > list, and exaggerated, over-the-top responses aren't going to help this >

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-22 Thread William ML Leslie
gt; hubo > ________________ > > 发件人:Armin Rigo <armin.r...@gmail.com> > 发送时间:2016-10-18 16:01 > 主题:Re: [pypy-dev] RFC: draft idea for making for loops automatically close > iterators > 收件人:"Nathaniel Smith"<n...@pobox.com> > 抄送:"Py

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-21 Thread Alex S.
That’s a good point, as it means there’s probably no safe & portable way to ensure that kind of stuff. «Trying to collect» something doesn’t really fall short of an actual collection, I believe (finding referers is hard). But I believe iterclose() defined appropriately on derived iterators would

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-21 Thread hubo
in.r...@gmail.com> 发送时间:2016-10-18 16:01 主题:Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators 收件人:"Nathaniel Smith"<n...@pobox.com> 抄送:"PyPy Developer Mailing List"<pypy-dev@python.org> Hi, On 17 October 2016 at 10:08, Nathanie

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-18 Thread Nathaniel Smith
Hi Oscar, Thanks for the comments! Can I ask that you hold onto them until I post to python-ideas, though? (Should be later today.) It's a discussion worth having, but if we have it here then we'll just end up having to repeat it there anyway :-). -n On Mon, Oct 17, 2016 at 5:04 AM, Oscar

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-18 Thread Armin Rigo
Hi, On 17 October 2016 at 10:08, Nathaniel Smith wrote: > thought I'd send around a draft to see what you think. (E.g., would > this be something that makes your life easier?) As a general rule, PyPy's GC behavior is similar to CPython's if we tweak the program to start a chain

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-17 Thread William ML Leslie
Have you considered Custodians, a-la racket? I suspect that adding resources to and finalising custodians requires less defensiveness than marking all iterables as resources, but I've yet to see someone implement them in python. https://docs.racket-lang.org/reference/custodians.html -- William

Re: [pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-17 Thread Oscar Benjamin
On 17 October 2016 at 09:08, Nathaniel Smith wrote: > Hi all, > > I've been poking at an idea for changing how 'for' loops work to > hopefully make them work better for pypy and async/await code. I > haven't taken it to python-ideas yet -- this is its first public > outing,

[pypy-dev] RFC: draft idea for making for loops automatically close iterators

2016-10-17 Thread Nathaniel Smith
Hi all, I've been poking at an idea for changing how 'for' loops work to hopefully make them work better for pypy and async/await code. I haven't taken it to python-ideas yet -- this is its first public outing, actually -- but since it directly addresses pypy GC issues I thought I'd send around a