Re: [Python-Dev] PySequence_Concat for dicts

2008-01-13 Thread Jared Flatow
On Jan 12, 2008, at 5:32 PM, Raymond Hettinger wrote: > Not natural, just inefficient and cute. Also, there was no answer > to the question about use cases. Fair enough. I will present some use cases below. > AFAICT, this feature has never been requested. The closest was a > feature request f

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-12 Thread Raymond Hettinger
[Raymond] >>> When does it come-up that you want a third summed dict >>> while keeping the two originals around unchanged? Does >>> it matter that the addition is non-commutative? Would >>> a + b + c produce an intermediate a/b combo and then >>> another new object for a/b/c so that the entries i

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-12 Thread Guido van Rossum
On Jan 12, 2008 8:51 AM, Jared Flatow <[EMAIL PROTECTED]> wrote: > > On Jan 11, 2008 5:21 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > >> When does it come-up that you want a third summed dict > >> while keeping the two originals around unchanged? Does > >> it matter that the addition is non

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-12 Thread Christian Heimes
Jared Flatow wrote: > p.s. If I were to get approval to implement some version of this, > which version of Python would be appropriate to work with? The minimum version is 2.6. 2.5 is in maintenance mode. Changes made to 2.6 are merged into 3.0 so you don't have to create two patches. It'd stick

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-12 Thread Jared Flatow
> On Jan 11, 2008 5:21 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >> When does it come-up that you want a third summed dict >> while keeping the two originals around unchanged? Does >> it matter that the addition is non-commutative? Would >> a + b + c produce an intermediate a/b combo and t

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-11 Thread Raymond Hettinger
> I'd like to take an "all or nothing" approach to this: either we > implement the same 4 operations as for sets (|, &, ^ and -) or we > implement none of them. . . . . > I'm not sure where I stand on this proposal -- I guess a +0, if > someone else does the work. (The abc.py module needs to be up

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-11 Thread Guido van Rossum
On Jan 11, 2008 5:21 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > I wasn't suggesting that the result of concatenation would > > be a chained table, rather that it would perform the > > equivalent of an update and return the new dict > >(the same way extend works for lists) > > When does

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-11 Thread Raymond Hettinger
> I wasn't suggesting that the result of concatenation would > be a chained table, rather that it would perform the > equivalent of an update and return the new dict >(the same way extend works for lists) When does it come-up that you want a third summed dict while keeping the two originals

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-11 Thread Jared Flatow
On Jan 11, 2008, at 6:45 PM, Raymond Hettinger wrote: > IMO, the chainmap() recipe on ASPN is a much better solution since > it doesn't create a third dictionary with the all the attendant > allocation and copying effort. I wasn't suggesting that the result of concatenation would be a chaine

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-11 Thread Raymond Hettinger
[Jared] > I think it would be convenient and pythonic if dict > objects implemented the PySequence_Concat method. IMO, the chainmap() recipe on ASPN is a much better solution since it doesn't create a third dictionary with the all the attendant allocation and copying effort. It isn't a common u