diff options
author | Raymond Hettinger <python@rcn.com> | 2007-11-15 03:16:09 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2007-11-15 03:16:09 (GMT) |
commit | 7c3738e11c35a7ac1c4ea8bdff9ec4d906db537e (patch) | |
tree | 6cd2aec952992d13dd7f6093cfab6bc0d6672a76 | |
parent | 213ae014dbeecf44a7adf2e14f38e0a52258f204 (diff) | |
download | cpython-7c3738e11c35a7ac1c4ea8bdff9ec4d906db537e.zip cpython-7c3738e11c35a7ac1c4ea8bdff9ec4d906db537e.tar.gz cpython-7c3738e11c35a7ac1c4ea8bdff9ec4d906db537e.tar.bz2 |
Example of multiple replacements.
-rw-r--r-- | Doc/library/collections.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 0c88861..89885ab 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__ |