[Python-Dev] PEP 370 and IronPython (original) (raw)
M.-A. Lemburg mal at egenix.com
Fri Oct 9 13:47:53 CEST 2009
- Previous message: [Python-Dev] PEP 370 and IronPython
- Next message: [Python-Dev] PEP 370 and IronPython
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Christian Heimes wrote:
Nick Coghlan wrote:
Importing yet-another-module for use in site.py doesn't sound like a great idea, so it may make sense to migrate that information into the sys module is this approach is taken. "sys.name" is a little generic though - something more explicit like "sys.vm" would be better. The platform modules uses additional modules like the re module. On my system "import platform" loads 7 additional module. The platform modul also uses multiple function calls and regular expression to detect the vm. I'm not going to blame the author of the function for the way the feature is implemented. It's the best way and I'd probably done it the same way, too. But it's an unnecessary slow down of every interpreter startup. 'sys.vm' it is.
Implementation specific user directories sound like a good idea indeed.
An alternative to a lookup table approach might be to be a little more direct and just retrieve the final part of the user specific directory name directly from a new function in the sys module. Then different VM authors can choose any directory name they want without CPython's site.py needing to know anything else about them. I like your idea. It might be a better idea to turn sys.vm into a struct like sys.floatinfo. The struct can contains a set of required attributes like an id, a capitalized name, the platform (C, .NET, Java) and the suffix for the user site directory.
sys.vm sys.vm(id='cpython', name='CPython', platform='C', usersitesuffix='python26') # on win32: Python2.6 sys.vm sys.vm(id='ironpython', name='IronPython', platform='.NET', usersitesuffix='ironpython26) # on win32: IronPython2.6
+1 on adding something like this, though, I'd use sys.python_implementation or just sys.implementation since not all Python implementations are virtual machines - many compile to machine code or some intermediate format.
-1 on importing platform in site.py. Python's startup time is not great to begin with and this would cause the load time to increase even more.
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, Oct 09 2009)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
- Previous message: [Python-Dev] PEP 370 and IronPython
- Next message: [Python-Dev] PEP 370 and IronPython
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]