Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Eric V. Smith
On 12/19/2017 2:38 AM, Steve Dower wrote: On 18Dec2017 2309, Steven D'Aprano wrote: [A LOT OF THINGS I AGREE WITH] I agree completely with Steven's reasoning here, and it bothers me that what is an irrelevant change to many users (dict becoming ordered) seems to imply that all users of dict hav

Re: [Python-Dev] Is static typing still optional?

2017-12-18 Thread Eric V. Smith
On 12/18/2017 9:41 PM, Chris Barker wrote: I'm really surprised no one seems to get my point here. TL;DR: My point is that having type annotation syntax required for something in the stdlib is a significant step toward "normalizing" type hinting in Python. Whether that's a good idea or not is

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Steve Dower
On 18Dec2017 2309, Steven D'Aprano wrote: > [A LOT OF THINGS I AGREE WITH] I agree completely with Steven's reasoning here, and it bothers me that what is an irrelevant change to many users (dict becoming ordered) seems to imply that all users of dict have to be updated. I have never needed Ordere

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Chris Angelico
On Tue, Dec 19, 2017 at 6:09 PM, Steven D'Aprano wrote: > I completely agree. We might argue that it was a mistake to sort dicts > in the first place, or at least a mistake to *always* sort them without > allowing the caller to provide a sort key. But what's done is done: the > fact that dicts are

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Steven D'Aprano
On Mon, Dec 18, 2017 at 08:28:52PM -0800, Chris Barker wrote: > On Mon, Dec 18, 2017 at 7:41 PM, Steven D'Aprano > wrote: > > > > With arbitrary order, it made sense to sort, so as to always give the > > same > > > "pretty" representation. But now that order is "part of" the dict itself, > > > it

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Nathaniel Smith
On Mon, Dec 18, 2017 at 7:58 PM, Steven D'Aprano wrote: > On Mon, Dec 18, 2017 at 07:37:03PM -0800, Nathaniel Smith wrote: >> On Mon, Dec 18, 2017 at 7:02 PM, Barry Warsaw wrote: >> > On Dec 18, 2017, at 21:11, Chris Barker wrote: >> > >> >> Will changing pprint be considered a breaking change?

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Chris Barker
On Mon, Dec 18, 2017 at 7:41 PM, Steven D'Aprano wrote: > > With arbitrary order, it made sense to sort, so as to always give the > same > > "pretty" representation. But now that order is "part of" the dict itself, > > it seems prettyprint should present the preserved order of the dict. > > I dis

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Steven D'Aprano
On Mon, Dec 18, 2017 at 07:37:03PM -0800, Nathaniel Smith wrote: > On Mon, Dec 18, 2017 at 7:02 PM, Barry Warsaw wrote: > > On Dec 18, 2017, at 21:11, Chris Barker wrote: > > > >> Will changing pprint be considered a breaking change? > > > > Yes, definitely. > > Wait, what? Why would changing pp

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Steven D'Aprano
On Mon, Dec 18, 2017 at 06:11:05PM -0800, Chris Barker wrote: > Now that dicts are order-preserving, maybe we should change prettyprint: > > In [7]: d = {'one':1, 'two':2, 'three':3} > > In [8]: print(d) > {'one': 1, 'two': 2, 'three': 3} > > order preserved. > > In [9]: pprint.pprint(d) > {'o

Re: [Python-Dev] PEP 567 -- Context Variables

2017-12-18 Thread Ben Darnell
On Mon, Dec 18, 2017 at 8:37 PM Yury Selivanov wrote: > > 3. The connection pool has a queue, and creates a task for each > connection to serve requests from that queue. Naively, each task could > inherit the context of the request that caused it to be created, but the > task would outlive the re

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Nathaniel Smith
On Mon, Dec 18, 2017 at 7:02 PM, Barry Warsaw wrote: > On Dec 18, 2017, at 21:11, Chris Barker wrote: > >> Will changing pprint be considered a breaking change? > > Yes, definitely. Wait, what? Why would changing pprint (so that it accurately reflects dict's new underlying semantics!) be a break

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Barry Warsaw
On Dec 18, 2017, at 21:11, Chris Barker wrote: > Will changing pprint be considered a breaking change? Yes, definitely. -Barry signature.asc Description: Message signed with OpenPGP ___ Python-Dev mailing list Python-Dev@python.org https://mail.pyt

Re: [Python-Dev] Is static typing still optional?

2017-12-18 Thread Barry Warsaw
On Dec 18, 2017, at 21:41, Chris Barker wrote: > > TL;DR: > My point is that having type annotation syntax required for something in the > stdlib is a significant step toward "normalizing" type hinting in Python. > Whether that's a good idea or not is a judgement call, but it IS a big step. Th

Re: [Python-Dev] Is static typing still optional?

2017-12-18 Thread Chris Barker
I'm really surprised no one seems to get my point here. TL;DR: My point is that having type annotation syntax required for something in the stdlib is a significant step toward "normalizing" type hinting in Python. Whether that's a good idea or not is a judgement call, but it IS a big step. @Chri

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Chris Barker
Now that dicts are order-preserving, maybe we should change prettyprint: In [7]: d = {'one':1, 'two':2, 'three':3} In [8]: print(d) {'one': 1, 'two': 2, 'three': 3} order preserved. In [9]: pprint.pprint(d) {'one': 1, 'three': 3, 'two': 2} order not preserved ( sorted, I presume? ) With arbit

Re: [Python-Dev] PEP 567 -- Context Variables

2017-12-18 Thread Ben Darnell
On Sun, Dec 17, 2017 at 2:49 PM Yury Selivanov wrote: > > One caveat based on Tornado's experience with stack_context: There are > times > > when the automatic propagation of contexts won't do the right thing (for > > example, a database client with a connection pool may end up hanging on > to >

Re: [Python-Dev] PEP 567 -- Context Variables

2017-12-18 Thread Yury Selivanov
On Mon, Dec 18, 2017 at 6:00 PM, Ivan Levkivskyi wrote: > On 13 December 2017 at 22:35, Yury Selivanov > wrote: >> >> [..] >> >> A new standard library module ``contextvars`` is added >> > >> > Why not add this to contextlib instead of adding a new module? IIRC >> > this was discussed relative t

Re: [Python-Dev] PEP 567 -- Context Variables

2017-12-18 Thread Yury Selivanov
> 3. The connection pool has a queue, and creates a task for each connection to > serve requests from that queue. Naively, each task could inherit the context > of the request that caused it to be created, but the task would outlive the > request and go on to serve other requests. The connection

Re: [Python-Dev] Broken svn lookup?

2017-12-18 Thread Victor Stinner
I don't need Subversion. I only need an online service redirecting me to the change. The bug tracker points to http://hg.python.org/lookup/r81190 which redirects to http://svn.python.org/view?view=revision&revision=81190 In the master branch, there is the Misc/svnmap.txt file which maps Subversio

Re: [Python-Dev] Broken svn lookup?

2017-12-18 Thread Benjamin Peterson
I turned viewvc off a few months ago because subversion is highly deprecated at this point. In fact, now that Windows build dependencies have moved off, I’m probably going to shut it off for good soon. On Mon, Dec 18, 2017, at 06:55, Victor Stinner wrote: > Hi, > > I was looking at old issues. In

Re: [Python-Dev] Decision of having a deprecation period or not for changing csv.DictReader returning type.

2017-12-18 Thread Brett Cannon
On Mon, 18 Dec 2017 at 07:30 Steve Holden wrote: > I submitted the 3.6 patch that Raymond committed. The purpose of the > change was to allow access to the ordering of the columns. > > It doesn't use any of the OrderedDict-only methods, and I'd be very > surprised if a reversion to using dict in

Re: [Python-Dev] PEP 567 -- Context Variables

2017-12-18 Thread Ivan Levkivskyi
On 13 December 2017 at 22:35, Yury Selivanov wrote: > [..] > >> A new standard library module ``contextvars`` is added > > > > Why not add this to contextlib instead of adding a new module? IIRC > > this was discussed relative to PEP 550, but I don't remember the > > reason. Regardless, it woul

Re: [Python-Dev] Is static typing still optional?

2017-12-18 Thread Eric V. Smith
On 12/18/2017 2:55 PM, Ivan Levkivskyi wrote: On 18 December 2017 at 20:38, Nick Coghlan > wrote: On 19 Dec. 2017 7:00 am, "Chris Barker" mailto:chris.bar...@noaa.gov>> wrote: Are there other options?? plain old: @dataclass clas

Re: [Python-Dev] Is static typing still optional?

2017-12-18 Thread Ivan Levkivskyi
On 18 December 2017 at 20:38, Nick Coghlan wrote: > > On 19 Dec. 2017 7:00 am, "Chris Barker" wrote: > > > Are there other options?? > > plain old: > > @dataclass > class C: > a = 1 > b = 1.0 > > would work, though then there would be no way to express fields without > defaults: > > > Th

Re: [Python-Dev] Is static typing still optional?

2017-12-18 Thread Nick Coghlan
On 19 Dec. 2017 7:00 am, "Chris Barker" wrote: Are there other options?? plain old: @dataclass class C: a = 1 b = 1.0 would work, though then there would be no way to express fields without defaults: The PEP already supports using "a = field(); b = field()" (etc) to declare untyped

Re: [Python-Dev] Is static typing still optional?

2017-12-18 Thread Ivan Levkivskyi
@David What you propose as `Infer` annotation was proposed some time ago (not only for dataclasses, there are other use cases). The discussion is here https://github.com/python/typing/issues/276 @Chris People are still allowed not to use dataclasses if they really don't like type hints :-) Serious

Re: [Python-Dev] Is static typing still optional?

2017-12-18 Thread Chris Barker
Good Bad or Neutral, this discussion makes my point: Using typing annotation as a necessary part of a standard library module is injecting typing into "ordinary" python in a new way. It is no longer going to appear to be completely optional, and only of concern to those that choose to use it (and

Re: [Python-Dev] Broken svn lookup?

2017-12-18 Thread Jonathan Goble
On Mon, Dec 18, 2017 at 9:57 AM Victor Stinner wrote: > Hi, > > I was looking at old issues. In > https://bugs.python.org/issue8610#msg105805 I found the link: > > http://svn.python.org/view?view=revision&revision=81190 > > Sadly, the link fails with HTTP 404 Not Found :-( > > Is the service do

Re: [Python-Dev] Decision of having a deprecation period or not for changing csv.DictReader returning type.

2017-12-18 Thread Steve Holden
I submitted the 3.6 patch that Raymond committed. The purpose of the change was to allow access to the ordering of the columns. It doesn't use any of the OrderedDict-only methods, and I'd be very surprised if a reversion to using dict in 3.7 would cause any tests to fail. regards Steve Steve Ho

Re: [Python-Dev] Decision of having a deprecation period or not for changing csv.DictReader returning type.

2017-12-18 Thread Guido van Rossum
Let's not do this. Once it's documented as returning an OrderedDict there's an additional promise about the API, e.g. move_to_end() exists. On Sun, Dec 17, 2017 at 10:30 PM, 尚辉 wrote: > Since regular dicts are ordered in 3.7, it might be cleaner to returning > regular dict instead of OrderedDic

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Steve Holden
On Fri, Dec 15, 2017 at 9:47 PM, Guido van Rossum wrote: > ​[...] > > stays ordered across deletions" part of the ruling is true in CPython 3.6. > > I don't know what guidance to give Eric, because I don't know what other > implementations do nor whether Eric cares about being compatible with >

[Python-Dev] Broken svn lookup?

2017-12-18 Thread Victor Stinner
Hi, I was looking at old issues. In https://bugs.python.org/issue8610#msg105805 I found the link: http://svn.python.org/view?view=revision&revision=81190 Sadly, the link fails with HTTP 404 Not Found :-( Is the service down? It's no more possible to browse the old Subversion repository? Vict

Re: [Python-Dev] Usefulness of binary compatibility accross Python versions?

2017-12-18 Thread Antoine Pitrou
On Sun, 17 Dec 2017 21:07:02 -0500 Random832 wrote: > > Is there any practical for of having the flag off for one slot and on > for another slot that's been added later? > > Could this be replaced (that is, a slot for such a thing added before > it's too late) with a simple counter that goes up