On 06/12/2012 06:36 PM, Wade Leftwich wrote:
With the Pyramid docs in ebook form on my phone I tend to browse them
at odd times. Today, standing in line at the post office, I stopped at
this paragraph right near the beginning:
"""
It’s useful to use a Python interpreter that isn’t the “system” Python
interpreter to develop your software. The authors of Pyramid tend not
to use the system Python for development purposes; always a self-
compiled one. Compiling Python is usually easy, and often the “system”
Python is compiled with options that aren’t optimal for web
development.
"""
... and wondered what the best compilation options for web development
might be. I generally use whatever comes with Ubuntu, which seems to
work OK. Does anyone have config tips to share?


That wording should probably be revisited because you're not the first to ask. More accurate is the statement "it's a real pain in the ass when someone walks into IRC and gives us a Python compilation scenario that can only be replicated with their particular OS/platform combination".

This tends to happen all the time on Mac, in particular, and fairly often on Ubuntu as well. This is usually because OS vendors tend to actually use the system Python and consider it more "part of the OS" than a development tool for third-party developers. OS vendors don't compile Python for usage by you; they compile it and configure it for usage by themselves. Their requirements may not be yours.

I don't use a Mac anymore, but when I did, and when I tried to help people get things running on their system Python, I was continually surprised by the number of things that went wrong and the amount of time people would spend trying to fix them without just compiling and installing another Python. If I sat down at a machine and tried to make the system Python work with Pyramid, with enough time and effort, I probably could. But someone new to Python probably could not, at least within a reasonable amount of time, and in that case, it's literally easier to just compile another one.

There's not one cause; each combination of Python version/OS version/platform combination tends to have its own set of endearing niggles that aren't much fun. In general, it's just a shortcut to consider the "system" Python the domain of the OS vendor and compile your own Python for your own work to shortcut all the potential landmines.

For example, Python on Ubuntu has the following default sys.path:

Python 2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']

Note the inclusion of Ubuntu-specific locations by default. This isn't a problem unless you don't use a virtualenv. But some (insanely) don't. I've seen some weird things happen as the result of these nonstandard dirs being included on sys.path by default in any case.

The system Python on Ubuntu (and many other Linux distros) is also compiled with UCS4 Unicode, which effectively doubles the space required in memory for each Unicode string without much benefit, as the 99% case for webapps doesn't include characters outside the UCS2 range (at least if those webapps don't use Asian scripts).

- C

--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to