Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Philipp A.
Hi Guido, As far as I can see, the general consensus seems to be to turn them back on in general: The last person to argue against it was Paul Moore, and he since said: “OK, I overstated [that you’re ‘hosed’ by DeprecationWarnings appearing]. Apologies. My recollection is of a lot more end user

Re: [Python-Dev] PEP 563: Postponed Evaluation of Annotations

2017-11-07 Thread Guido van Rossum
To top off today's set of hopeful thread closures I want to put this one to rest. While I'm not ready to accept PEP 563 yet (I'm waiting for the first cut of the implementation) I *am* hereby nixing the thunk idea. When I said I was more worried about that than about the stringification that

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Guido van Rossum
I'd call that a feature request. :-) On Tue, Nov 7, 2017 at 9:28 PM, Nick Coghlan wrote: > On 8 November 2017 at 14:58, Guido van Rossum wrote: > > What does "RFE" mean? I don't recall hearing that term before on the > Python > > bug tracker. Request For

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

2017-11-07 Thread Guido van Rossum
It seems there must be at least two threads for each topic worth discussing at all. Therefore I feel compelled to point to https://mail.python.org/pipermail/python-dev/2017-November/150381.html, where I state my own conclusion about dict order. I know Paul Sokolovsky does not claim to speak for

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Nick Coghlan
On 8 November 2017 at 14:58, Guido van Rossum wrote: > What does "RFE" mean? I don't recall hearing that term before on the Python > bug tracker. Request For E-what? (I presume it's a RedHat internal term?) Request for Enhancement (as opposed to a bug report). It's not Red Hat

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Guido van Rossum
I'll probably get complaints because I'm not waiting for the benchmark results to come in, but I think I've seen enough. To me the only defensible behavior *other than the pre-3.6 behavior* is that after deletions the order remains preserved and new insertions happen at the end -- i.e. the same

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Guido van Rossum
What does "RFE" mean? I don't recall hearing that term before on the Python bug tracker. Request For E-what? (I presume it's a RedHat internal term?) On Tue, Nov 7, 2017 at 6:57 PM, Nick Coghlan wrote: > On 8 November 2017 at 11:46, Guido van Rossum wrote:

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Steven D'Aprano
On Tue, Nov 07, 2017 at 05:37:15PM +0200, Serhiy Storchaka wrote: > 07.11.17 16:56, Steven D'Aprano пише: > >To clarify: if we start with an empty dict, add keys A...D, delete B, > >then add E...H, we could expect: [...] > Rather > > {A: 1, D: 4, C: 3} # move the last item in place of removed >

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Random832
On Tue, Nov 7, 2017, at 09:56, Steven D'Aprano wrote: > Don't let the perfect be the enemy of the good. > > For many applications, keys are never removed from the dict, so this > doesn't matter. If you never delete a key, then the remaining keys will > never be reordered. > > I think that

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Joao S. O. Bueno
Sorry - trigger happy on the previous message. On 6 November 2017 at 05:09, Guido van Rossum wrote: > I still find this unfriendly to users of Python scripts and small apps who > are not the developers of those scripts. (Large apps tend to spit out so > much logging it doesn't

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Joao S. O. Bueno
On 6 November 2017 at 05:09, Guido van Rossum wrote: > I still find this unfriendly to users of Python scripts and small apps who > are not the developers of those scripts. (Large apps tend to spit out so > much logging it doesn't really matter.) > > Isn't there a better

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Nick Coghlan
On 8 November 2017 at 07:19, Evpok Padding wrote: > On 7 November 2017 at 21:47, Chris Barker wrote: >> if dict order is preserved in cPython , people WILL count on it! > > I won't, and if people do and their code break, they'll have only

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Nick Coghlan
On 8 November 2017 at 11:46, Guido van Rossum wrote: > On Tue, Nov 7, 2017 at 5:35 PM, Nick Coghlan wrote: >> >> On 8 November 2017 at 10:03, Guido van Rossum wrote: >> > OK, so let's come up with a set of heuristics that does the right

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

2017-11-07 Thread INADA Naoki
On Wed, Nov 8, 2017 at 5:35 AM, Paul G wrote: > If dictionary order is *not* guaranteed in the spec and the dictionary order > isn't randomized (which I think everyone agrees is a bit messed up), it would > probably be useful if you could enable "random order mode" in CPython,

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Guido van Rossum
To cut this thread short, I say we should use Nick's proposal to turn these warnings on for __main__ but off elsewhere. (See https://mail.python.org/pipermail/python-dev/2017-November/150364.html.) -- --Guido van Rossum (python.org/~guido) ___

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

2017-11-07 Thread INADA Naoki
> 2. Switches keyword args and class body execution namespaces over to > odict so the test suite passes again > 3. Measures the impact such a change would have on the benchmark suite For now, odict use twice memory and 2x slower on iteration. https://bugs.python.org/issue31265#msg301942 INADA

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

2017-11-07 Thread Nick Coghlan
On 8 November 2017 at 11:44, Nick Coghlan wrote: > 2. So far, I haven't actually come up with a perturbed iteration > implementation that doesn't segfault the interpreter. The dict > internals are nicely laid out to be iteration friendly, but they > really do assume that

Re: [Python-Dev] Reminder: PEP 479's __future__ about to become the default behavior

2017-11-07 Thread Guido van Rossum
Thanks for the reminder! I don't know if it's that simple -- did you grep for occurrences of that flag (CO_FUTURE_GENERATOR_STOP)? And I suppose there are tests for both sides that need to be adjusted? On Tue, Nov 7, 2017 at 5:17 PM, Lukasz Langa wrote: > This is according to

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Barry Warsaw
Antoine Pitrou wrote: > On Mon, 6 Nov 2017 23:23:25 +1000 >> - tweak the default warning filters to turn DeprecationWarning back on >> for __main__ only > > Thats sounds error-prone. I'd rather have them on by default > everywhere. If DeprecationWarnings were on by default, and setuptools were

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

2017-11-07 Thread Barry Warsaw
On Nov 7, 2017, at 16:15, Chris Barker - NOAA Federal wrote: > Actually, there is a LOT of code out there that expects reference counting. I > know a lot of my code does. So if cPython does abandon it some day, there > will be issues. I see this all the time in code

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Guido van Rossum
On Tue, Nov 7, 2017 at 5:35 PM, Nick Coghlan wrote: > On 8 November 2017 at 10:03, Guido van Rossum wrote: > > OK, so let's come up with a set of heuristics that does the right thing > for > > those cases specifically. I'd say whenever you're executing code

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

2017-11-07 Thread Nick Coghlan
On 8 November 2017 at 07:15, Paul Moore wrote: > On 7 November 2017 at 20:35, Paul G wrote: >> If dictionary order is *not* guaranteed in the spec and the dictionary order >> isn't randomized (which I think everyone agrees is a bit messed up), it >> would

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Nick Coghlan
On 8 November 2017 at 10:03, Guido van Rossum wrote: > OK, so let's come up with a set of heuristics that does the right thing for > those cases specifically. I'd say whenever you're executing code from a > zipfile or some such it's not considered your own code (by default). My

[Python-Dev] Reminder: PEP 479's __future__ about to become the default behavior

2017-11-07 Thread Lukasz Langa
This is according to https://www.python.org/dev/peps/pep-0479/#transition-plan but looking at Objects/genobject.c that hasn't been implemented yet. Is this as simple as removing the `else` clause here?

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

2017-11-07 Thread INADA Naoki
> By the way, I only just realized I can delete a key to demonstrate > non-order-preservation on py 3.6. So at least I know what to tell students > now. > You can't. dict in Python 3.6 preserves insertion order even after key deletion. ___ Python-Dev

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Guido van Rossum
Let me just cut this short. typing.py will stay, and it will stay provisional. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

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

2017-11-07 Thread Chris Barker - NOAA Federal
This seems like overkill to me. By the same logic, we should add a "delay garbage collection" mode, that allows people to test that their code doesn't make unwarranted assumptions that a reference-counting garbage collector is in use. Actually, there is a LOT of code out there that expects

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Guido van Rossum
OK, so let's come up with a set of heuristics that does the right thing for those cases specifically. I'd say whenever you're executing code from a zipfile or some such it's not considered your own code (by default). On Tue, Nov 7, 2017 at 2:16 PM, Nick Coghlan wrote: > On 8

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Barry Warsaw
On Nov 7, 2017, at 13:34, Jakub Wilk wrote: > "import async" would indeed cause deprecation warning, but that's not what > ldap3 does. The only uses of the now-keyword "async" in their codebase are > like this: > > from ..strategy.async import AsyncStrategy > from .async

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Lukasz Langa
> On Nov 7, 2017, at 2:33 PM, Nick Coghlan wrote: > > On 8 November 2017 at 04:41, Lukasz Langa wrote: >> 4. How do we even version this library then? Probably like this: 3.7.0.0, >> 3.7.0.1, 3.7.1.0, and so on. But that depends on answers to the other >>

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Jakub Wilk
* Barry Warsaw , 2017-11-06, 15:56: We also depend on ldap3 . Suddenly we get a SyntaxError because ldap3 has a module ldap3/strategy/async.py. I say "suddenly" because of course *if* DeprecationWarnings had been enabled by default, I'm sure

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Nick Coghlan
On 8 November 2017 at 04:41, Lukasz Langa wrote: > 4. How do we even version this library then? Probably like this: 3.7.0.0, > 3.7.0.1, 3.7.1.0, and so on. But that depends on answers to the other > questions above. Something you may want to consider is switching to CalVer for

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Nick Coghlan
On 8 November 2017 at 06:32, Guido van Rossum wrote: > On Mon, Nov 6, 2017 at 7:23 PM, Terry Reedy wrote: >> >> On 11/6/2017 9:47 PM, Nick Coghlan wrote: >> [...] >>> >>> - "only show me legacy calls in *my* code" (the "I trust my deps to >>> take care of

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread MRAB
On 2017-11-07 14:17, Philipp A. wrote: Nick Coghlan > schrieb am Di., 7. Nov. 2017 um 14:57 Uhr: Users of applications written in Python are not python-dev's users: they're the users of those applications, and hence the quality of that

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

2017-11-07 Thread Paul G
@ Paul Moore > This seems like overkill to me. By the same logic, we should add a > "delay garbage collection" mode, that allows people to test that their > code doesn't make unwarranted assumptions that a reference-counting > garbage collector is in use. But you can get pretty fine-grained

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

2017-11-07 Thread Paul Moore
On 7 November 2017 at 21:13, Chris Barker wrote: > the "only until first deletion" part is really hard -- I hope we don't go > that route. But I don't think insertion-order is non-obvious -- particularly > with literals. But I thought we *had* gone that route. Actually,

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Evpok Padding
On 7 November 2017 at 21:47, Chris Barker wrote: > On Tue, Nov 7, 2017 at 11:50 AM, Tim Peters wrote: > >> Is it worth guaranteeing that will always "work" (as intended)? Not >> to me, but I do have code that relies on it now - > > > This is

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

2017-11-07 Thread Barry Warsaw
On Nov 7, 2017, at 12:35, Paul G wrote: > > If dictionary order is *not* guaranteed in the spec and the dictionary order > isn't randomized (which I think everyone agrees is a bit messed up), it would > probably be useful if you could enable "random order mode" in CPython, so

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

2017-11-07 Thread Paul Moore
On 7 November 2017 at 20:35, Paul G wrote: > If dictionary order is *not* guaranteed in the spec and the dictionary order > isn't randomized (which I think everyone agrees is a bit messed up), it would > probably be useful if you could enable "random order mode" in CPython, so

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

2017-11-07 Thread Chris Barker
On Tue, Nov 7, 2017 at 7:21 AM, David Mertz wrote: > But like Raymond, I make most of my living TEACHING Python. > and I make least of my living TEACHING Python ( :-) ),and: > I feel like the extra order guarantee would make teaching slightly harder. > I can't understand how

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Tim Delaney
On 8 November 2017 at 03:55, Barry Warsaw wrote: > On Nov 7, 2017, at 05:44, Paul Moore wrote: > > > If you're a user and your application developer didn't do (1) or a > > library developer developing one of the libraries your application > > developer

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Chris Barker
On Tue, Nov 7, 2017 at 11:50 AM, Tim Peters wrote: > Is it worth guaranteeing that will always "work" (as intended)? Not > to me, but I do have code that relies on it now - This is critically important -- no one looks at the language spec to figure out how something

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

2017-11-07 Thread Paul G
If dictionary order is *not* guaranteed in the spec and the dictionary order isn't randomized (which I think everyone agrees is a bit messed up), it would probably be useful if you could enable "random order mode" in CPython, so you can stress-test that your code isn't making any assumptions

Re: [Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

2017-11-07 Thread Guido van Rossum
On Mon, Nov 6, 2017 at 7:23 PM, Terry Reedy wrote: > On 11/6/2017 9:47 PM, Nick Coghlan wrote: > [...] > >> - "only show me legacy calls in *my* code" (the "I trust my deps to >> take care of themselves" use case) >> > > Perhaps this should be the new default, where 'my code'

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

2017-11-07 Thread Nathaniel Smith
On Nov 7, 2017 12:02 PM, "Barry Warsaw" wrote: On Nov 7, 2017, at 09:39, Paul Sokolovsky wrote: > So, the problem is that there's no "Python language spec”. There is a language specification: https://docs.python.org/3/refe rence/index.html But there are

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Tim Peters
[Peter Ludemann] > Does it matter whether the dict order after pop/delete is explicitly > specified, or just specified that it's deterministic? Any behavior whatsoever becomes essential after it becomes known ;-) For example, dicts as currently ordered easily support LRU (least recently used)

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Barry Warsaw
Antoine Pitrou wrote: > Well... It really depends what kind of problem you're solving. I > certainly delete or pop items from dicts quite often. > > Let's not claim that deleting items from a dict is a rare or advanced > feature. It is not. +1. It's a pretty common pattern for handling

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Barry Warsaw
On Nov 7, 2017, at 10:41, Lukasz Langa wrote: > 3. Does that mean that Debian is going to rip it out and make people install > a `python-typing` .deb? Sadly, probably yes. We need to figure out what that > means for us. Maybe. Full disclosure, I’ve recently scaled back my

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Peter Ludemann via Python-Dev
Does it matter whether the dict order after pop/delete is explicitly specified, or just specified that it's deterministic? On 7 November 2017 at 11:28, Antoine Pitrou wrote: > On Wed, 8 Nov 2017 06:19:46 +1100 > Chris Angelico wrote: > > > > I've used a

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Antoine Pitrou
On Wed, 8 Nov 2017 06:19:46 +1100 Chris Angelico wrote: > > I've used a good few dictionary objects in my time, but most of them > have literally never had any items deleted from them. Well... It really depends what kind of problem you're solving. I certainly delete or pop

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 1:32 AM, Antoine Pitrou wrote: > On Wed, 8 Nov 2017 00:01:04 +1000 > Nick Coghlan wrote: > >> On 7 November 2017 at 23:48, Stefan Krah wrote: >> > >> > >> > This is just a reminder that the current dict is not

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Lukasz Langa
> On Nov 7, 2017, at 9:39 AM, Brett Cannon wrote: > > On Tue, 7 Nov 2017 at 03:34 Paul Moore > wrote: > > Because type annotations are a development-time feature, they should > *not* require a dependency in the final

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Lukasz Langa
> On Nov 6, 2017, at 8:01 PM, Nick Coghlan wrote: > > As I indicated in my comment there, I'm now wondering if there might > be an opportunity here whereby we could use the *dataclasses* module > to define a stable non-provisional syntactically compatible subset of > the

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

2017-11-07 Thread Barry Warsaw
On Nov 7, 2017, at 09:39, Paul Sokolovsky wrote: > So, the problem is that there's no "Python language spec”. There is a language specification: https://docs.python.org/3/reference/index.html But there are still corners that are undocumented, or topics that are

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

2017-11-07 Thread Mark Lawrence
On 07/11/17 04:05, David Mertz wrote: I strongly opposed adding an ordered guarantee to regular dicts. If the implementation happens to keep that, great. Maybe OrderedDict can be rewritten to use the dict implementation. But the evidence that all implementations will always be fine with this

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

2017-11-07 Thread Paul Sokolovsky
Hello, On Tue, 7 Nov 2017 14:40:07 +0900 INADA Naoki wrote: > I agree with Raymond. dict ordered by default makes better developer > experience. > > So, my concern is how "language spec" is important for minor (sorry > about my bad vocabulary) implementation? > What's

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Brett Cannon
On Tue, 7 Nov 2017 at 03:34 Paul Moore wrote: > On 7 November 2017 at 10:18, Steve Holden wrote: > > On Tue, Nov 7, 2017 at 12:35 AM, Donald Stufft wrote: > > [..] > > > >> > >> Maybe we just need to fully flesh out the idea of a

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

2017-11-07 Thread Paul Sokolovsky
Hello, On Tue, 7 Nov 2017 17:33:03 +1100 Steven D'Aprano wrote: > On Mon, Nov 06, 2017 at 06:35:48PM +0200, Paul Sokolovsky wrote: > > > For MicroPython, it would lead to quite an overhead to make > > dictionary items be in insertion order. As I mentioned, MicroPython > >

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Barry Warsaw
On Nov 7, 2017, at 05:44, Paul Moore wrote: > If you're a user and your application developer didn't do (1) or a > library developer developing one of the libraries your application > developer chose to use didn't do (2), you're hosed. If you're a user > who works in an

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

2017-11-07 Thread Barry Warsaw
On Nov 7, 2017, at 01:51, Petr Viktorin wrote: > > When I explained this in 3.5, dicts rearranging themselves seemed quite weird > to the newcomers. > This year, I'm not looking forward to saying that dicts behave "intuitively", > but you shouldn't rely on that, because

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Nathaniel Smith
On Nov 7, 2017 06:24, "Nick Coghlan" wrote: On 7 November 2017 at 19:30, Paul Moore wrote: > On 7 November 2017 at 04:09, Nick Coghlan wrote: >> Given the status quo, how do educators learn that the examples they're >> teaching to

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

2017-11-07 Thread Barry Warsaw
On Nov 6, 2017, at 22:33, Steven D'Aprano wrote: > I think it would be reasonable to say that builtin dicts only maintain > insertion order for insertions, lookups, and changing the value. Any > mutation which deletes keys may arbitrarily re-order the dict. > > If the user

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Barry Warsaw
On Nov 7, 2017, at 07:12, Antoine Pitrou wrote: > The problem is this is taking things to a level of precision that makes > the guarantee tedious to remember and reason about. > > The only thing that's friendly to (non-expert) users is either "dicts > are always ordered [by

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread INADA Naoki
>> > If further guarantees are proposed, perhaps it would be a good idea to >> > open a new thread and state what exactly is being proposed. >> >> "Insertion ordered until the first key removal" is the only guarantee >> that's being proposed. > > Is it? It seems to me that many arguments being

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Serhiy Storchaka
07.11.17 16:56, Steven D'Aprano пише: To clarify: if we start with an empty dict, add keys A...D, delete B, then add E...H, we could expect: {A: 1} {A: 1, B: 2} {A: 1, B: 2, C: 3} {A: 1, B: 2, C: 3, D: 4} {D: 4, A: 1, C: 3} # some arbitrary reordering {D: 4, A: 1, C: 3, E: 5} {D: 4, A: 1, C:

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

2017-11-07 Thread David Mertz
On Nov 6, 2017 9:11 PM, "Raymond Hettinger" wrote: > On Nov 6, 2017, at 8:05 PM, David Mertz wrote: > I strongly opposed adding an ordered guarantee to regular dicts. If the implementation happens to keep that, great. Maybe OrderedDict can be

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

2017-11-07 Thread Thomas Nyberg
On 11/07/2017 09:00 AM, Wolfgang wrote: > Hi, > > I have to admit sometimes I don't understand why small things produce so much > mail traffic. :-) > > If I use a mapping like dict most of the time I don't care if it is ordered. > If I need an ordering I use OrderedDict. In a library if I need a

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

2017-11-07 Thread Evpok Padding
Hello, I agree with Wolfgang here. From what I gathered of the discussion, the argument started from « It would be nice if dict litterals returned ordered dicts instead of an unordered ones », which is mostly a good thing, as it allows e.g. `OrderedDict({'spam': 'ham', 'sausages': 'eggs'})`

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Antoine Pitrou
On Tue, 7 Nov 2017 09:44:07 -0500 Yury Selivanov wrote: > > One common pattern that I see frequently is this: > > def foo(**kwargs): > kwargs.pop('somekey', None) > bar(**kwargs) I see it frequently too, but that's in code meant to be Python

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Antoine Pitrou
On Wed, 8 Nov 2017 01:56:42 +1100 Steven D'Aprano wrote: > > I think that Nick's intent was not to say that after a single deletion, > the ordering guarantee goes away "forever", but that a deletion may be > permitted to reorder the keys, after which further additions will

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Steven D'Aprano
On Tue, Nov 07, 2017 at 03:32:29PM +0100, Antoine Pitrou wrote: [...] > > "Insertion ordered until the first key removal" is the only guarantee > > that's being proposed. > > Is it? It seems to me that many arguments being made are only relevant > under the hypothesis that insertion is ordered

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Yury Selivanov
On Tue, Nov 7, 2017 at 9:32 AM, Antoine Pitrou wrote: > On Wed, 8 Nov 2017 00:01:04 +1000 > Nick Coghlan wrote: > >> On 7 November 2017 at 23:48, Stefan Krah wrote: >> > >> > >> > This is just a reminder that the current dict is not

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Toshio Kuratomi
On Nov 7, 2017 5:47 AM, "Paul Moore" wrote: On 7 November 2017 at 13:35, Philipp A. wrote: > Sorry, I still don’t understand how any of this is a problem. > > If you’re an application developer, google “python disable > DeprecationWarning” and paste the

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Antoine Pitrou
On Wed, 8 Nov 2017 00:01:04 +1000 Nick Coghlan wrote: > On 7 November 2017 at 23:48, Stefan Krah wrote: > > > > > > This is just a reminder that the current dict is not an "OrderedDict": > > > from collections import OrderedDict >

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Paul Moore
On 7 November 2017 at 14:21, Ethan Furman wrote: > On 11/07/2017 05:44 AM, Paul Moore wrote: > >> If you're a user and your application developer didn't do (1) or a >> library developer developing one of the libraries your application >> developer chose to use didn't do (2),

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Ethan Furman
On 11/07/2017 05:44 AM, Paul Moore wrote: If you're a user and your application developer didn't do (1) or a library developer developing one of the libraries your application developer chose to use didn't do (2), you're hosed. If you're a user who works in an environment where moving to a new

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Philipp A.
Nick Coghlan schrieb am Di., 7. Nov. 2017 um 14:57 Uhr: > Users of applications written in Python are not python-dev's users: > they're the users of those applications, and hence the quality of that > experience is up to the developers of those applications. […] > Thank you,

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Stefan Krah
On Wed, Nov 08, 2017 at 12:01:04AM +1000, Nick Coghlan wrote: > > The recent proposal was primarily about guaranteeing the insertion order of > > dict literals. > > > > If further guarantees are proposed, perhaps it would be a good idea to > > open a new thread and state what exactly is being

Re: [Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Nick Coghlan
On 7 November 2017 at 23:48, Stefan Krah wrote: > > > This is just a reminder that the current dict is not an "OrderedDict": > from collections import OrderedDict OrderedDict(a=0, b=1) == OrderedDict(b=1, a=0) > False dict(a=0, b=1) == dict(b=1, a=0) > True > >

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Nick Coghlan
On 7 November 2017 at 23:44, Paul Moore wrote: > As I say, the proposal prioritises developer convenience over end user > experience. Users of applications written in Python are not python-dev's users: they're the users of those applications, and hence the quality of that

[Python-Dev] The current dict is not an "OrderedDict"

2017-11-07 Thread Stefan Krah
This is just a reminder that the current dict is not an "OrderedDict": >>> from collections import OrderedDict >>> OrderedDict(a=0, b=1) == OrderedDict(b=1, a=0) False >>> dict(a=0, b=1) == dict(b=1, a=0) True The recent proposal was primarily about guaranteeing the insertion order of dict

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Paul Moore
On 7 November 2017 at 13:35, Philipp A. wrote: > Sorry, I still don’t understand how any of this is a problem. > > If you’re an application developer, google “python disable > DeprecationWarning” and paste the code you found, so your users don’t see > the warnings. > If

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Philipp A.
Sorry, I still don’t understand how any of this is a problem. 1. If you’re an application developer, google “python disable DeprecationWarning” and paste the code you found, so your users don’t see the warnings. 2. If you’re a library developer, and a library you depend on raises

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

2017-11-07 Thread Jan Claeys
On Tue, 2017-11-07 at 16:39 +1000, Nick Coghlan wrote: > And this is the key point for me: "choosing not to choose" is > effectively the same as standardising the feature, as enough Python > code will come to rely on CPython's behaviour that most alternative > implementations will feel obliged to

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Nick Coghlan
On 7 November 2017 at 19:30, Paul Moore wrote: > On 7 November 2017 at 04:09, Nick Coghlan wrote: >> Given the status quo, how do educators learn that the examples they're >> teaching to their students are using deprecated APIs? > > By reading the

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Paul Moore
On 7 November 2017 at 10:18, Steve Holden wrote: > On Tue, Nov 7, 2017 at 12:35 AM, Donald Stufft wrote: > [..] > >> >> Maybe we just need to fully flesh out the idea of a "Python Core" (What >> exists now as “Python”) and a “Python Platform” (Python Core +

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Steve Holden
On Tue, Nov 7, 2017 at 12:35 AM, Donald Stufft wrote: [..] > Maybe we just need to fully flesh out the idea of a "Python Core" (What > exists now as “Python”) and a “Python Platform” (Python Core + A select set > of preinstalled libraries). Then typing can just be part of the

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

2017-11-07 Thread Paul Moore
On 7 November 2017 at 06:39, Nick Coghlan wrote: > On 7 November 2017 at 09:23, Chris Barker wrote: >> in short -- we don't have a choice (unless we add an explicit randomization >> as some suggested -- but that just seems perverse...) > > And this is

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

2017-11-07 Thread Petr Viktorin
On 11/07/2017 09:00 AM, Wolfgang wrote: [...] Also it is fine to teach people that dict (Mapping) is not ordered but CPython has an implementation detail and it is ordered. But if you want the guarantee use OrderedDict. I don't think that is fine. When I explained this in 3.5, dicts

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Antoine Pitrou
On Tue, 7 Nov 2017 09:30:19 + Paul Moore wrote: > > I understand the "but no-one actually does this" argument. And I > understand that breakage as a result is worse than a few warnings. But > enabling deprecation warnings by default feels to me like favouring > the

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Paul Moore
On 7 November 2017 at 05:20, Ethan Smith wrote: > I'm not so keen on this because I think some things in typing (such as > NamedTuple) probably deserve to be in the collections module. And some of > the ABCs could probably also be merged with collections.abc but doing this >

Re: [Python-Dev] Remove typing from the stdlib

2017-11-07 Thread Paul Moore
On 7 November 2017 at 00:35, Donald Stufft wrote: > Maybe we just need to fully flesh out the idea of a "Python Core" (What > exists now as “Python”) and a “Python Platform” (Python Core + A select set > of preinstalled libraries). Then typing can just be part of the Python >

Re: [Python-Dev] Proposal: go back to enabling DeprecationWarning by default

2017-11-07 Thread Paul Moore
On 7 November 2017 at 04:09, Nick Coghlan wrote: > Given the status quo, how do educators learn that the examples they're > teaching to their students are using deprecated APIs? By reading the documentation on what they are teaching, and by testing their examples with new

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

2017-11-07 Thread Wolfgang
Hi, I have to admit sometimes I don't understand why small things produce so much mail traffic. :-) If I use a mapping like dict most of the time I don't care if it is ordered. If I need an ordering I use OrderedDict. In a library if I need a dict to be ordered most of the time there is a