This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Sam De Meyer, docs@python, rhettinger, serhiy.storchaka
Date 2017-05-09.21:35:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494365742.57.0.70039754582.issue30322@psf.upfronthosting.co.za>
In-reply-to
Content
This from the help on dict.update():

 |  update(...)
 |      D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
 |      If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
 |      If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
 |      In either case, this is followed by: for k in F: D[k] = F[k]

Likewise in the source for collections.abc.MutableMapping:

    def update(*args, **kwds):
        ''' D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
            If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
            If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
            In either case, this is followed by: for k, v in F.items(): D[k] = v
        '''
        if not args:
            raise TypeError("descriptor 'update' of 'MutableMapping' object "
                            "needs an argument")
        self, *args = args
        if len(args) > 1:
            raise TypeError('update expected at most 1 arguments, got %d' %
                            len(args))
        if args:
            other = args[0]
            if isinstance(other, Mapping):
                for key in other:
                    self[key] = other[key]
            elif hasattr(other, "keys"):
                for key in other.keys():
                    self[key] = other[key]
            else:
                for key, value in other:
                    self[key] = value
        for key, value in kwds.items():
            self[key] = value
History
Date User Action Args
2017-05-09 21:35:42rhettingersetrecipients: + rhettinger, docs@python, serhiy.storchaka, Sam De Meyer
2017-05-09 21:35:42rhettingersetmessageid: <1494365742.57.0.70039754582.issue30322@psf.upfronthosting.co.za>
2017-05-09 21:35:42rhettingerlinkissue30322 messages
2017-05-09 21:35:42rhettingercreate