The current docstring for dict.update shows: ======================================================================== ==== >>> help(dict.update) Help on method_descriptor:
update(...) D.update(E, **F) -> None. Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E 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] >>> ======================================================================== ==== Better, would be something like: ======================================================================== ==== update(...) D.update(E=None, **F) -> None. Update D from dict/iterable E and F. If E is not None then: If E has a .keys() method, does: for k in E: D[k] = E[k] If E 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] ======================================================================== ==== The current signature states that argument "E" is mandatory, when it is not. eg. >>> d = {} >>> d.update(mykey={1:2}) # just keywords passed in, no "E" >>> I tried subclassing the builtin dict using the current signature as a guide, but my implementation was incorrect since I had assumed there was a mandatory argument, "E". Regards, Gerrat _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com