Showing content from http://mail.python.org/pipermail/python-dev/attachments/20120102/9e334de7/attachment.html below:
<div class="gmail_quote">On Mon, Jan 2, 2012 at 4:07 PM, Jim Jewett <span dir="ltr"><<a href="mailto:jimjjewett@gmail.com">jimjjewett@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div class="h5">On Mon, Jan 2, 2012 at 1:16 AM, PJ Eby <<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>> wrote:<br>
> On Sun, Jan 1, 2012 at 10:28 PM, Jim Jewett <<a href="mailto:jimjjewett@gmail.com">jimjjewett@gmail.com</a>> wrote:<br>
>><br>
>> Given the wording requiring a real dictionary, I would have assumed<br>
>> that it was OK (if perhaps not sensible) to do pointer arithmetic and<br>
>> access the keys/values/hashes directly. (Though if the breakage was<br>
>> between python versions, I would feel guilty about griping too<br>
>> loudly.)<br>
<br>
> If you're going to be a language lawyer about it, I would simply point out<br>
> that all the spec requires is that "type(env) is dict" -- it says nothing<br>
> about how Python defines "type" or "is" or "dict". So, you're on your own<br>
> with that one. ;-)<br>
<br>
</div></div>But the public header file <<br>
<a href="http://hg.python.org/cpython/file/3ed5a6030c9b/Include/dictobject.h" target="_blank">http://hg.python.org/cpython/file/3ed5a6030c9b/Include/dictobject.h</a> ><br>
defines the typedef structs for PyDictEntry and _dictobject.<br>
<br>
What is the purpose of the requiring a "real dict" without also<br>
promising what the header file promises?<br><br></blockquote><div><br></div><div>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:</div>
<div><br></div><div>1. The struct layout doesn't guarantee anything about insertion or lookup algorithms,</div><div>2. If the data structure were changed, the header file would obviously change as well, and</div><div>
3. ISTM that Python does not even promise inter-version ABI compatibility for internals like the dict object layout.</div><div><br></div><div>Are you seriously writing code that relies on the C structure layout of dicts? 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. I'm occasionally considered notorious for abusing Python internals, but even I have to draw the line somewhere. ;-)</div>
<div><br></div></div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4