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/20150128/9f8f2294/attachment.html below:

<div dir="ltr">The names stored in op_names are totally unrelated as they can be attribute names, module names, global names; you basically don't know much about them unless you also inspect the actual bytecode using them (and the same name can be used in completely different ways in different parts of the same code object). In my opinion introspection code telling me that the name `foo` is used but not knowing if it's about a global, a module name or an attribute name is not going to be that useful, on the other hand if you do inspect the bytecode then using co_consts doesn't make things more complicate.<div><br></div><div>Anyway I was just curious to know if there was any technical reason (that I couldn't see) or if it was more a style/historic reason.</div><div><br></div><div>Thank you for the clarification</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 28, 2015 at 1:40 PM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 28 January 2015 at 21:21, Greg Ewing <<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>> wrote:<br>
> Andrea Griffini wrote:<br>
>><br>
>> Sorry if the question is naive, but why is co_names needed? Wouldn't be<br>
>> simpler to just use co_consts?<br>
><br>
> One reason might be that keeping them separate means<br>
> you can have up to 256 names and 256 consts using<br>
> 1-byte opcode arguments. Otherwise, you'd be limited<br>
> to a total of 256 of both.<br>
<br>
</span>They're logically distinct things accessed by different opcodes for<br>
very different purposes. While you theoretically *could* use one array<br>
to hold both, it would make the eval code harder to read, and various<br>
introspection tasks (like "tell me all the names referenced from this<br>
code object") significantly more difficult.<br>
<br>
Cheers,<br>
Nick.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Nick Coghlan  Â |  Â <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>  Â |  Â Brisbane, Australia<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/agriff%40tin.it" target="_blank">https://mail.python.org/mailman/options/python-dev/agriff%40tin.it</a><br>
</div></div></blockquote></div><br></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