From: Raymond Hettinger Date: Thu, 15 Nov 2007 03:16:09 +0000 (+0000) Subject: Example of multiple replacements. X-Git-Tag: v2.6a1~1052 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c3738e11c35a7ac1c4ea8bdff9ec4d906db537e;p=python Example of multiple replacements. --- diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 0c88861c76..89885abd76 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -463,8 +463,8 @@ two additonal methods and a read-only attribute. >>> p.__replace__(x=33) Point(x=33, y=22) - >>> for recordnum, record in inventory: - ... inventory[recordnum] = record.replace(total = record.price * record.quantity) + >>> for partnum, record in inventory.items(): + ... inventory[partnum] = record.__replace__(price=newprices[partnum], updated=time.now()) .. attribute:: somenamedtuple.__fields__