On Wed, 12 Jan 2005 23:47:13 GMT, "Rick Morrison" <[EMAIL PROTECTED]> wrote:
>I could live with creating a new dict, sure (although it seems wasteful). I
>realize that something like this probably doesn't stand a chance of ever
>making it into the std library for what might be called "philosophica
On Wed, 12 Jan 2005 23:47:13 GMT, Rick Morrison
<[EMAIL PROTECTED]> wrote:
> I could live with creating a new dict, sure (although it seems wasteful). I
> realize that something like this probably doesn't stand a chance of ever
> making it into the std library for what might be called "philosophica
Rick Morrison wrote:
> >>> [updated(d, {'c':3}) for d in [{'a':1, 'b':2}, {'x':10,
'y':'11'}]]
> [{'a': 1, 'c': 3, 'b': 2}, {'y': '11', 'x': 10, 'c': 3}]
I don't really understand the use of this. Can you give a less toy
example? I'd probably just do
dicts = [{'a':1, 'b':2}, {'x':10, 'y':'11'}]
Rick Morrison wrote:
I could live with creating a new dict, sure (although it seems wasteful). I
realize that something like this probably doesn't stand a chance of ever
making it into the std library for what might be called "philosophical"
reasons. I just want it for me (my personal philosophy ru
I could live with creating a new dict, sure (although it seems wasteful). I
realize that something like this probably doesn't stand a chance of ever
making it into the std library for what might be called "philosophical"
reasons. I just want it for me (my personal philosophy runs more to the
pragma
Rick Morrison wrote:
Would there be any way to add a method to all dict objects that operated
like the .update() method, but also returned a reference to the updated
dict?
Are you looking for updated() to parallel sorted(), where sorted()
returns a *new* list? I doubt you'll be able to rally much
Would there be any way to add a method to all dict objects that operated
like the .update() method, but also returned a reference to the updated
dict?
.update() is clumsy to use inside of list comprehensions and the like. Or am
I missing something?
Thanks,
Rick
--
http://mail.python.org/mail