[Python-Dev] That depends on what the meaning of "is" is (was Re: http://mail.python.org/pipermail/python-dev/2011-December/115172.html)

Jim Jewett jimjjewett at gmail.com
Tue Jan 3 20:55:32 CET 2012


On Mon, Jan 2, 2012 at 7:16 PM, PJ Eby <pje at telecommunity.com> wrote:
> On Mon, Jan 2, 2012 at 4:07 PM, Jim Jewett <jimjjewett at gmail.com> wrote:

>> But the public header file <
>> http://hg.python.org/cpython/file/3ed5a6030c9b/Include/dictobject.h >
>> defines the typedef structs for PyDictEntry and _dictobject.

>> What is the purpose of the requiring a "real dict" without also
>> promising what the header file promises?

> Er, just because it's in the .h doesn't mean it's in the public API.  But in
> any event, if you're actually serious about this, I'd just point out that:

> 1. The struct layout doesn't guarantee anything about insertion or lookup
> algorithms,

My concern was about your suggestion of changing the data structure to
accommodate some other algorithm -- particularly if it meant that  the
data would no longer be stored entirely in an array of PyDictEntry.

That shouldn't be done lightly even between major versions, and
certainly should not be done in a bugfix (or security-only) release.

> Are you seriously writing code that relies on the C structure layout of
> dicts?

The first page of search results for PyDictEntry suggested that others
are.  (The code I found did seem to be for getting data from a python
dict into some other language, rather than for wsgi.)

>  Because really, that was SO not the point of the dict type
> requirement.  It was so that you could use Python's low-level *API* calls,
> not muck about with the data structure directly.

Would it be too late to clarify that in the PEP itself?

-jJ


More information about the Python-Dev mailing list