<br><br><div class="gmail_quote">On Sat, Apr 5, 2008 at 3:00 PM, Jim Jewett &lt;<a href="mailto:jimjjewett@gmail.com">jimjjewett@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
How have you decided which attributes are CPython-specific?<br>
I&#39;m not saying your decisions are wrong, but I find all of them at<br>
least up for questioning.<br>
<br>
Those marked non-CPython-specific<br>
============================<br>
<br>
 &nbsp; - argv<br>
<br>
Does this make sense for embedded python?</blockquote><div>Maybe, that doesn&#39;t mean it shouldn&#39;t be there. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
 &nbsp; - byteorder<br>
<br>
This seems fairly low-level. &nbsp;I wouldn&#39;t expect to need it if working<br>
strictly at the python level, unless writing wire-protocols *and*<br>
working with objects larger than bytes.<br>
<br>
If you do need it, should text representation (UCS2 vs UCS4 vs UTF8 vs<br>
bytestrings) be exposed?</blockquote><div>It should probably go to platform. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>

<div class="Ih2E3d"><br>
 &nbsp; - builtin_module_names, path, and modules<br>
<br>
</div>I&#39;m not sure why these three are together.<br>
What is the builtin_module_names?</blockquote><div>Modules which are compiled into the interpreter (like sys and nt, mac, or posix). Maybe, it should go to interpreter.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
sys.path might be an oddball on a database-based system, such as classic PalmOS.<br>
<div class="Ih2E3d"><br>
 &nbsp; - subversion, copyright, hexversion, version, and version_info<br>
<br>
</div>These do seem reasonable; they refer to the executable. &nbsp;Though even<br>
then, I wonder if there should be a way to extend it for<br>
customizations. &nbsp;(&quot;embedded in XYZ&quot;, or &quot;without unicode&quot;)<br>
<div class="Ih2E3d"><br>
 &nbsp; - displayhook, __displayhook__<br>
 &nbsp; - excepthook, __excepthook__, exc_info, and exc_clear<br>
<br>
</div>Are these required of every implementation?</blockquote><div>Every one that wants to work. :) <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<div class="Ih2E3d"><br>
 &nbsp; - exec_prefix and prefix<br>
 &nbsp; - executable<br>
 &nbsp; - exit<br>
<br>
</div>Are &nbsp;these? &nbsp;And do they make sense when embedded?</blockquote><div>sys.executable and exec_prefix is allowed to be empty.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<div class="Ih2E3d"><br>
 &nbsp; - flags, py3kwarning, dont_write_bytecode, and warn_options<br>
<br>
</div>Is the bytecode stage itself a crucial part of the langauge? &nbsp;I had<br>
thought of the the bytecode as an implementation detail, and so<br>
whether or not to write it out would seem even more<br>
implementation-specific.</blockquote><div>What the bytecode is and how it is generated is implementation specific. It&#39;s not the fact you&#39;re writing it or not. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
 &nbsp; - getfilesystemencoding<br>
<br>
OK; but this seems to interact with text representation and path.<br>
<br>
 &nbsp; - get/setprofile<br>
 &nbsp; - get/settrace<br>
<br>
These seem as CPython-specific as anything frame-related.</blockquote><div>Jython provides them. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
 &nbsp; - getwindowsversion<br>
<br>
This obviously doesn&#39;t make sense on a non-windows machine; why isn&#39;t<br>
it in platform instead of sys?<br>
<br>
 &nbsp; - maxint and maxunicode<br>
<br>
I&#39;m not sure what value these have. &nbsp;I assume maxint doesn&#39;t include<br>
longs -- so is it just the maximum efficiently represented integer, or<br>
is this specific to C extensions, or ..?</blockquote><div>The maximum int on the system. Jython provides this.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
And is maxunicode just roundabout way of figuring out the concrete<br>
representation (code points) of unicode characters?</blockquote><div>It is the max Unicode character&nbsp; that Python&#39;s unicode implementation is capable of handling. Jython provides this.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
 &nbsp; - platform<br>
<br>
Should this be subsumed by the platform module?</blockquote><div>Hmm. I don&#39;t know. For basic platform tests, this sure is easy. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
 &nbsp; - ps1 and ps2<br>
<br>
This really seems like a config issue rather than sys.</blockquote><div>Yeh, sys is about runtime Python. Besides, it&#39;s global to all implementations. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<div class="Ih2E3d"><br>
 &nbsp; - stdin, stderr, stdout, __stdin__, __stderr__, __stdout__<br>
<br>
</div>These, at least, are clear -- to the extent that they make sense. &nbsp;(In<br>
some environments, they don&#39;t.)<br>
<br>
 &nbsp; - tracebacklimit<br>
<br>
How is this different from setrecursionlimit?</blockquote><div>It defines how many lines of traceback are printed in an exception. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
Those marked CPython-specific<br>
=========================<br>
<br>
 &nbsp; - get/setrecursionlimit<br>
 &nbsp; - get/setcheckinterval<br>
<br>
These are runtime characteristics, but I don&#39;t see them (necessarily)<br>
being tied to the implementation. &nbsp;Just returning False to say the<br>
limit isn&#39;t relevant makes sense, and returning some huge number may<br>
work in practice. &nbsp;If you care enough to say &quot;Can I recurse 3000<br>
frames?&quot;, that is a legitimate question, and it just so happens that<br>
Jython should always answer &quot;yes&quot;.</blockquote><div>Actually, I believe you get a stack overflow before that. It doesn&#39;t tell you that. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
 &nbsp; - _getframe and _current_frame<br>
<br>
I expect the details of a frame may be different with different<br>
implementations, but is there an implemenation that doesn&#39;t have<br>
frames at all? &nbsp;(I could imagine that it is a pain to get a frame from<br>
a compiled version, but the Java tracebacks and introspection need<br>
something roughly equivalent.)</blockquote><div>Well, it&#39;s not there now... <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>

<br>
 &nbsp; - getrefcount<br>
<br>
This should probably be in gc, rather that sys.<br>
<div class="Ih2E3d"><br>
 &nbsp; - get/setdlopenflags<br>
 &nbsp; - settscdumps<br>
 &nbsp; - api_version<br>
 &nbsp; - winver<br>
 &nbsp; - dllhandle<br>
 &nbsp; - float_info<br>
<br>
</div>I don&#39;t find all of these in 2.5 help(sys), but to the extent I<br>
understand them, they are about extensions rather the system. &nbsp;If<br>
Python under java or &nbsp;.net did open .dlls or support ffi extensions, I<br>
would expect a similar API.</blockquote><div>Some of them are new in 2.6. Look at those docs. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<div class="Ih2E3d"><br>
 &nbsp; - _compact_freelists<br>
 &nbsp; - _clear_type_cache<br>
<br>
</div>These should probably be in gc, rather that sys.<br>
<br>
<br>
To summarize my alternative<br>
======================<br>
<br>
sys -- representing the built system<br>
<div class="Ih2E3d"><br>
 &nbsp; - subversion, copyright, hexversion, version, and version_info<br>
</div> &nbsp; - builtin_module_names<br>
<div class="Ih2E3d"> &nbsp; - exec_prefix and prefix<br>
 &nbsp; - executable<br>
 &nbsp; - exit<br>
<br>
</div>gc -- representing memory management<br>
<br>
 &nbsp; - getrefcount<br>
<div class="Ih2E3d"> &nbsp; - _compact_freelists<br>
 &nbsp; - _clear_type_cache<br>
<br>
</div>platform -- representing the OS environment<br>
 &nbsp; - getfilesystemencoding<br>
 &nbsp; - getwindowsversion<br>
 &nbsp; - platform<br>
<br>
runtime -- representing this particular runtime environment</blockquote><div>Sys is the runtime environment. We don&#39;t need a new module for that.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
 &nbsp; - argv<br>
 &nbsp; - path (today&#39;s sys.path, not os.path)<br>
 &nbsp; - modules<br>
<div class="Ih2E3d"> &nbsp; - displayhook, __displayhook__<br>
 &nbsp; - excepthook, __excepthook__, exc_info, and exc_clear<br>
</div> &nbsp; - flags<br>
 &nbsp; - py3kwarning, warn_options &nbsp;(why are these not just in warnings?)<br>
 &nbsp; - dont_write_bytecode<br>
 &nbsp; - get/setprofile<br>
 &nbsp; - get/settrace<br>
<div class="Ih2E3d"> &nbsp; - ps1 and ps2<br>
 &nbsp; - stdin, stderr, stdout, __stdin__, __stderr__, __stdout__<br>
<br>
 &nbsp; - tracebacklimit<br>
</div><div class="Ih2E3d"> &nbsp; - get/setrecursionlimit<br>
 &nbsp; - get/setcheckinterval<br>
 &nbsp; - _getframe and _current_frame<br>
<br>
<br>
</div>ffi &nbsp;-- representing bit-level foreign function interface details<br>
(maybe tied to ctypes?)<br>
<br>
 &nbsp; - byteorder<br>
 &nbsp; - maxint and maxunicode<br>
 &nbsp; - get/setdlopenflags<br>
 &nbsp; - settscdumps &nbsp; # I&#39;m not sure what this one is<br>
<div class="Ih2E3d"> &nbsp; - api_version<br>
 &nbsp; - winver<br>
 &nbsp; - dllhandle<br>
 &nbsp; - float_info<br>
<br>
<br>
</div>(whehter os and os.path should also be mixed in to the reorg ... is a<br>
different question.)<br>
<font color="#888888"><br>
-jJ<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Cheers,<br>Benjamin Peterson