Issue 10240: dict.update.doc is misleading (original) (raw)

Created on 2010-10-30 02:34 by ivank, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
dict.update.__doc__.patch ivank,2010-10-30 02:34 mention fast path and .keys()
Messages (5)
msg119954 - (view) Author: ivank (ivank) Date: 2010-10-30 02:34
It would be nice if dict.update.__doc__ conveyed some of the subtleties of the update algorithm. See the patch. I changed __doc__ to mention the fast path for dicts, and changed one instance of E: -> E.keys():
msg119961 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-10-30 06:07
I'm not sure that we should mention the fast path for dicts. That is an implementation detail and may not be present in IronPython, PyPy, Jython, etc. The current version includes: D.updated(E, **F) --> None. Updated D for dict/iterable E and F. ISTM that covers the semantics of what it does. Your proposed modification gets into how it does it.
msg119962 - (view) Author: ivank (ivank) Date: 2010-10-30 06:32
CPython's dict(obj) ignores `keys` and `__iter__` if obj is a subclass of dict. I thought this was an important language detail, not just an implementation quirk. But, I just tested pypy 1.3, and it is calling .keys() on dicts. Oh well. I think the __doc__ can still be slightly improved; ignore my patch and just change the first E: to E.keys(): - that would be more accurate.
msg119978 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-10-30 12:59
Maybe the fastpath should do a strict check and not be used for subclasses of dict?
msg214412 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-03-21 22:09
> Maybe the fastpath should do a strict check and not > be used for subclasses of dict? This code is ancient and well-established. IMO, nothing good can come from changing it (besides slowing down code that is already deployed and working fine).
History
Date User Action Args
2022-04-11 14:57:08 admin set github: 54449
2014-09-01 07:19:45 rhettinger set status: open -> closedresolution: rejected
2014-08-31 07:41:27 berker.peksag set nosy: - berker.peksag
2014-03-21 22:09:31 rhettinger set assignee: docs@python -> rhettingermessages: +
2014-03-21 08:54:34 berker.peksag set nosy: + berker.peksag, docs@pythonassignee: docs@pythoncomponents: + Documentation, - Interpreter Coreversions: + Python 3.4, Python 3.5, - Python 3.1, Python 3.2
2010-11-02 19:02:18 eric.araujo set nosy: + eric.araujoversions: - Python 2.6, Python 2.5, Python 3.3
2010-10-30 12:59:48 r.david.murray set nosy: + r.david.murraymessages: +
2010-10-30 06:32:32 ivank set messages: +
2010-10-30 06:07:24 rhettinger set nosy: + rhettingermessages: +
2010-10-30 02:34:06 ivank create