A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

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">&lt;<a href="mailto:jimjjewett@gmail.com">jimjjewett@gmail.com</a>&gt;</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 &lt;<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>&gt; wrote:<br>
&gt; On Sun, Jan 1, 2012 at 10:28 PM, Jim Jewett &lt;<a href="mailto:jimjjewett@gmail.com">jimjjewett@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Given the wording requiring a real dictionary, I would have assumed<br>
&gt;&gt; that it was OK (if perhaps not sensible) to do pointer arithmetic and<br>
&gt;&gt; access the keys/values/hashes directly.  (Though if the breakage was<br>
&gt;&gt; between python versions, I would feel guilty about griping too<br>
&gt;&gt; loudly.)<br>
<br>
&gt; If you&#39;re going to be a language lawyer about it, I would simply point out<br>
&gt; that all the spec requires is that &quot;type(env) is dict&quot; -- it says nothing<br>
&gt; about how Python defines &quot;type&quot; or &quot;is&quot; or &quot;dict&quot;.  So, you&#39;re on your own<br>
&gt; with that one. ;-)<br>
<br>
</div></div>But the public header file &lt;<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> &gt;<br>
defines the typedef structs for PyDictEntry and _dictobject.<br>
<br>
What is the purpose of the requiring a &quot;real dict&quot; without also<br>
promising what the header file promises?<br><br></blockquote><div><br></div><div>Er, just because it&#39;s in the .h doesn&#39;t mean it&#39;s in the public API.  But in any event, if you&#39;re actually serious about this, I&#39;d just point out that:</div>
<div><br></div><div>1. The struct layout doesn&#39;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&#39;s low-level *API* calls, not muck about with the data structure directly.  I&#39;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