Re: [Python-Dev] Ordering keyword dicts

2013-06-10 Thread Ron Adam
On 06/09/2013 10:13 PM, Alexander Belopolsky wrote: On Sun, May 19, 2013 at 1:47 AM, Guido van Rossum gu...@python.org mailto:gu...@python.org wrote: I'm slow at warming up to the idea. My main concern is speed -- since most code doesn't need it and function calls are already slow

Re: [Python-Dev] Ordering keyword dicts

2013-06-09 Thread Alexander Belopolsky
On Sun, May 19, 2013 at 1:47 AM, Guido van Rossum gu...@python.org wrote: I'm slow at warming up to the idea. My main concern is speed -- since most code doesn't need it and function calls are already slow (and obviously very common :-) it would be a shame if this slowed down function calls

Re: [Python-Dev] Ordering keyword dicts

2013-05-20 Thread Armin Rigo
Hi all, On Sun, May 19, 2013 at 4:59 PM, Maciej Fijalkowski fij...@gmail.com wrote: Note that raymonds proposal would make dicts and ordereddicts almost exactly the same speed. Just checking: in view of Raymond's proposal, is there a good reason against having all dicts be systematically

Re: [Python-Dev] Ordering keyword dicts

2013-05-20 Thread Barry Warsaw
On May 20, 2013, at 02:30 PM, Armin Rigo wrote: Just checking: in view of Raymond's proposal, is there a good reason against having all dicts be systematically ordered? It would definitely improve the debugging experience, by making multiple runs of the same program more like each other,

Re: [Python-Dev] Ordering keyword dicts

2013-05-20 Thread fwierzbi...@gmail.com
On Mon, May 20, 2013 at 6:39 AM, Barry Warsaw ba...@python.org wrote: Or in other words, if dicts are to be ordered, let's make it an explicit language feature that we can measure compliance against. Guaranteeing a dict order would be tough on Jython - today it's nice that we can just have a

Re: [Python-Dev] Ordering keyword dicts

2013-05-20 Thread Guido van Rossum
I think that kills the let's make all dicts ordered idea, even for CPython. I wouldn't want people to start relying on this. The dict type should be clearly recognizable as the hash table it is. Making **kwds ordered is still open, but requires careful design and implementation to avoid slowing

Re: [Python-Dev] Ordering keyword dicts

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 11:35 AM, Greg Ewing greg.ew...@canterbury.ac.nz wrote: Joao S. O. Bueno wrote: Actually, when I was thinking on the subject I came to the same idea, of having some functions marked differently so they would use a different call mechanism - but them I wondered around

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Skip Montanaro
On Sat, May 18, 2013 at 10:27 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: BTW, I'm +1 on the idea for ordering keyword-args. It makes it easier to debug if the arguments show-up in the order they were created. AFAICT, no purpose is served by scrambling them (which is

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Antoine Pitrou
On Sat, 18 May 2013 22:47:35 -0700 Guido van Rossum gu...@python.org wrote: On Sat, May 18, 2013 at 10:27 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: BTW, I'm +1 on the idea for ordering keyword-args. It makes it easier to debug if the arguments show-up in the order they were

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Nick Coghlan
On Sun, May 19, 2013 at 11:01 PM, Antoine Pitrou solip...@pitrou.net wrote: The main use case seems to be the OrderedDict constructor itself. Otherwise, I can't think of any situation where I would've wanted it. I've had a couple related to populating other mappings where order matters, at

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Guido van Rossum
Hm. Wouldn'tvevery call site be slowed down by checking for that flag? — Sent from Mailbox On Sun, May 19, 2013 at 7:42 AM, Nick Coghlan ncogh...@gmail.com wrote: On Sun, May 19, 2013 at 11:01 PM, Antoine Pitrou solip...@pitrou.net wrote: The main use case seems to be the OrderedDict

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Maciej Fijalkowski
On Sun, May 19, 2013 at 4:40 PM, Nick Coghlan ncogh...@gmail.com wrote: On Sun, May 19, 2013 at 11:01 PM, Antoine Pitrou solip...@pitrou.net wrote: The main use case seems to be the OrderedDict constructor itself. Otherwise, I can't think of any situation where I would've wanted it. I've had

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Joao S. O. Bueno
On 19 May 2013 11:57, Guido van Rossum gvanros...@gmail.com wrote: Hm. Wouldn'tvevery call site be slowed down by checking for that flag? Actually, when I was thinking on the subject I came to the same idea, of having some functions marked differently so they would use a different call mechanism

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Nick Coghlan
On 20 May 2013 00:57, Guido van Rossum gvanros...@gmail.com wrote: Hm. Wouldn'tvevery call site be slowed down by checking for that flag? Yeah, I forgot about having to push everything through the tp_call slot, so we can't easily limit the ordering check to just those cases where the callable

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Greg Ewing
Joao S. O. Bueno wrote: Actually, when I was thinking on the subject I came to the same idea, of having some functions marked differently so they would use a different call mechanism - but them I wondered around having a different opcode for the ordered-dict calls. Would that be feasible? No,

[Python-Dev] Ordering keyword dicts

2013-05-18 Thread Guido van Rossum
On Sat, May 18, 2013 at 10:27 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: BTW, I'm +1 on the idea for ordering keyword-args. It makes it easier to debug if the arguments show-up in the order they were created. AFAICT, no purpose is served by scrambling them (which is exacerbated