Re: [Python-ideas] Civility on this mailing list

2016-10-21 Thread Paul Moore
On 21 October 2016 at 15:26, Nick Coghlan wrote: > - Remember that even if something we vehemently consider "wrong" makes > it into the reference implementation, the language does have a design > policy that allows us to correct design mistakes after a suitable > deprecation

Re: [Python-ideas] Fwd: Fwd: Fwd: unpacking generalisations for list comprehension

2016-10-21 Thread Nick Coghlan
On 21 October 2016 at 05:09, Random832 wrote: > On Tue, Oct 18, 2016, at 02:10, Nick Coghlan wrote: >> Hi, I contributed the current list comprehension implementation (when >> refactoring it for Python 3 to avoid leaking the iteration variable, >> as requested in PEP 3100

Re: [Python-ideas] Order of loops in list comprehension

2016-10-21 Thread Sven R. Kunze
On 21.10.2016 01:43, Greg Ewing wrote: Alexander Heger wrote: For me the current behaviour does not seem unreasonable as it resembles the order in which you write out loops outside a comprehension That's true, but the main reason for having comprehensions syntax in the first place is so that

Re: [Python-ideas] Multiple level sorting in python where the order of some levels may or may not be reversed

2016-10-21 Thread Sven R. Kunze
On 17.10.2016 23:53, Paul Moore wrote: On 17 October 2016 at 22:28, Mark Lawrence via Python-ideas wrote: How about changing https://wiki.python.org/moin/HowTo/Sorting ? Good point. Better still, https://docs.python.org/3.6/howto/sorting.html Don't know what the

Re: [Python-ideas] Conditional Assignment in If Statement

2016-10-21 Thread Sven R. Kunze
On 18.10.2016 00:11, Michael duPont wrote: What does everyone think about: if foo = get_foo(): bar(foo) as a means to replace: foo = get_foo() if not foo: bar(foo) del foo Might there be some better syntax or a different keyword? I constantly run into this sort of use case.

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Ronan Lamy
Le 21/10/16 à 14:35, Paul Moore a écrit : [1] As I understand it. CPython's refcounting GC makes this a non-issue, correct? Wrong. Any guarantee that you think the CPython GC provides goes out of the window as soon as you have a reference cycle. Refcounting does not actually make GC

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Paul Moore
On 21 October 2016 at 21:59, Chris Barker wrote: >> So (it seems to >> me) that you're talking about changing the behaviour of for-loops to >> suit only a small proportion of cases: maybe 10% of 10%. > > > I don't see what the big overhead is here. for loops would get a new

Re: [Python-ideas] please try to keep things civil

2016-10-21 Thread Ethan Furman
On 10/21/2016 12:13 PM, Mark Lawrence via Python-ideas wrote: This list is irrelevant. The PSF has to be consistent across all of its lists. This list is not irrelevant, and yes *volunteers who moderate* should be consistent. Who the hell is Marietta, I don't recall a single post from

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Yury Selivanov
On 2016-10-21 11:19 AM, Gustavo Carneiro wrote: Personally, I hadn't realised we had this problem in asyncio until now. Does this problem happen in asyncio at all? Or does asyncio somehow work around it by making sure to always explicitly destroy the frames of all coroutine objects, as long

Re: [Python-ideas] please try to keep things civil

2016-10-21 Thread Ned Batchelder
On 10/21/16 3:13 PM, Mark Lawrence via Python-ideas wrote: > On 17/10/2016 19:29, Brett Cannon wrote: >> >> >> On Sun, 16 Oct 2016 at 09:39 Mark Lawrence via Python-ideas >> > > wrote: >> >> On 16/10/2016 16:41, Mariatta Wijaya wrote:

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Chris Barker
On Fri, Oct 21, 2016 at 12:12 AM, Steven D'Aprano wrote: > Portability across Pythons... if all Pythons performed exactly the same, > why would we need multiple implementations? The way I see it, > non-deterministic cleanup is the cost you pay for a non-reference > counting

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Amit Green
NOTE: This is my first post to this mailing list, I'm not really sure how to post a message, so I'm attempting a reply-all. I like Nathaniel's idea for __iterclose__. I suggest the following changes to deal with a few of the complex issues he discussed. 1. Missing __iterclose__, or a

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Nathaniel Smith
On Fri, Oct 21, 2016 at 3:48 PM, Amit Green wrote: > NOTE: This is my first post to this mailing list, I'm not really sure > how to post a message, so I'm attempting a reply-all. > > I like Nathaniel's idea for __iterclose__. > > I suggest the following changes to deal

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Ethan Furman
On 10/21/2016 03:48 PM, Amit Green wrote: NOTE: This is my first post to this mailing list, I'm not really sure how to post a message, so I'm attempting a reply-all. Seems to have worked! :) I like Nathaniel's idea for __iterclose__. I suggest the following changes to deal with a

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Nathaniel Smith
On Fri, Oct 21, 2016 at 3:29 AM, Steven D'Aprano wrote: > As for the amount of good, this proposal originally came from PyPy. Just to be clear, I'm not a PyPy dev, and the PyPy devs' contribution here was mostly to look over a draft I circulated and to agree that it seemed

[Python-ideas] Smart/Curly Quote Marks and cPython

2016-10-21 Thread Ryan Birmingham
Hello everyone, I want to start small and ask about smart/curly quote marks (” vs "). Although most languages do not support these characters as quotation marks, I believe that cPython should, if possible. I'm willing to write the patch, of course, but I wanted to ask about this change, if it has

Re: [Python-ideas] Smart/Curly Quote Marks and cPython

2016-10-21 Thread Ethan Furman
On 10/21/2016 10:17 PM, Ryan Birmingham wrote: I want to start small and ask about smart/curly quote marks (” vs "). Although most languages do not support these characters as quotation marks, I believe that cPython should, if possible. I'm willing to write the patch, of course, but I wanted

Re: [Python-ideas] Smart/Curly Quote Marks and cPython

2016-10-21 Thread Ryan Birmingham
I was thinking of using them only as possibly quotes characters, as students and beginners seem to have difficulties due to this quote-mismatch error. That OSX has smart quotes enabled by default makes this a worthwhile consideration, in my opinion. -Ryan Birmingham On 22 October 2016 at 01:34,

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Nathaniel Smith
On Wed, Oct 19, 2016 at 7:07 PM, Terry Reedy wrote: > On 10/19/2016 12:38 AM, Nathaniel Smith wrote: > >> I'd like to propose that Python's iterator protocol be enhanced to add >> a first-class notion of completion / cleanup. > > > With respect the the standard iterator

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Nathaniel Smith
On Wed, Oct 19, 2016 at 3:07 PM, Paul Moore wrote: > On 19 October 2016 at 20:21, Nathaniel Smith wrote: >> On Wed, Oct 19, 2016 at 11:38 AM, Paul Moore wrote: >>> On 19 October 2016 at 19:13, Chris Angelico wrote:

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Steven D'Aprano
You know, I'm actually starting to lean towards this proposal and away from my earlier objections... On Wed, Oct 19, 2016 at 12:33:57PM -0700, Nathaniel Smith wrote: > I should also say, regarding your specific example, I guess it's an > open question whether we would want

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Paul Moore
On 21 October 2016 at 10:53, Steven D'Aprano wrote: > On Wed, Oct 19, 2016 at 12:33:57PM -0700, Nathaniel Smith wrote: > >> I should also say, regarding your specific example, I guess it's an >> open question whether we would want list_iterator.__iterclose__ to >> actually do

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Paul Moore
On 21 October 2016 at 12:23, Steven D'Aprano wrote: > On Fri, Oct 21, 2016 at 11:03:51AM +0100, Paul Moore wrote: > >> At the moment, the take home message for such users feels like it's >> "you might need to scatter preserve() around your code, to avoid the >> behaviour

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Steven D'Aprano
On Fri, Oct 21, 2016 at 11:07:46AM +0100, Paul Moore wrote: > On 21 October 2016 at 10:53, Steven D'Aprano wrote: > > On Wed, Oct 19, 2016 at 12:33:57PM -0700, Nathaniel Smith wrote: > > > >> I should also say, regarding your specific example, I guess it's an > >> open

Re: [Python-ideas] Civility on this mailing list

2016-10-21 Thread Nick Coghlan
On 19 October 2016 at 21:29, Michel Desmoulin wrote: > +1. > > I read many disagreements, and people being rude and unprofessional on > occasions, but nothing that would make me have a bad day, even when I was > the target of it. > > I feel like people are really

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-21 Thread Steven D'Aprano
On Fri, Oct 21, 2016 at 11:03:51AM +0100, Paul Moore wrote: > At the moment, the take home message for such users feels like it's > "you might need to scatter preserve() around your code, to avoid the > behaviour change described above, which you glazed over because it > talked about all that