merits of Lisp vs Python

T

Tim Bradshaw

(nee "One Laptop Per Child", OLPC, and once known as the "$100 laptop")
uses Python as its preferred (only?-) application language, and it's
slated to be the most widely distributed Python distro if it hits even
half of its ambitious target-numbers...

But it won't get anywhere near that because it's a stupid an
ill-conceived idea (not because of Python, note!). The electronic
gadget people need in the developing world is a mobile phone not a
computer.
 
M

Michael Bentley

But it won't get anywhere near that because it's a stupid an
ill-conceived idea (not because of Python, note!). The electronic
gadget people need in the developing world is a mobile phone not a
computer.

Isn't the idea to provide a learning environment for children in the
developing world (rather than a generally useful gadget)? Perhaps a
mobile phone would also be good for this sort of thing -- if it had a
'show source' button :)

obpython: isn't OLPC is right in line with 'Computer Programming for
Everybody'?
 
G

Gabriel Genellina

On 2007-03-09 07:00:06 +0000, (e-mail address removed) (Alex Martelli) said:
But it won't get anywhere near that because it's a stupid an
ill-conceived idea (not because of Python, note!). The electronic
gadget people need in the developing world is a mobile phone not a
computer.

What for?
That requires a phone company, installed antennas everywhere, and
available power to charge batteries. Without forgetting you to pay the
bill, of course.
I don't think OLPC would actually help people so much, but a mobile phone
would be almost useless. Like it was -actually happened- donating nice
computers for use in remote elementary schools with no power source.
 
P

Paul Boddie

Gabriel said:
What for?
That requires a phone company, installed antennas everywhere, and
available power to charge batteries. Without forgetting you to pay the
bill, of course.

"What people in the developing world needs is Iridium!" Oops! ;-) I've
heard of people doing interesting things with mobile phones in various
developing countries, and I'm sure that the infrastructure is
gradually expanding in some places, but the mobile phone is largely a
"consumer" device: you pay big corporations to use their networks and
to download largely frivolous content. I hardly think such things are
on the same page as the OLPC vision.
I don't think OLPC would actually help people so much, but a mobile phone
would be almost useless. Like it was -actually happened- donating nice
computers for use in remote elementary schools with no power source.

Yes, such things were mentioned in the FOSDEM OLPC talk [1]. It's all
very well having rich Europeans or Americans (especially thinking of
people like Bill Gates who seems to opine regularly on such things in
a way which is unlikely to be completely disconnected to his business
interests) saying that all the old kit that people don't want any more
(because they must have that new quad-core laptop!) should be shipped
out to places that "need" it, but the issue is whether the recipients
really do need to have aging, power-hungry technology with special
waste disposal requirements when it finally gives up the ghost.

Sure, give people a bunch of old PCs (and why not all those CRTs,
too?) which consume tens of watts per unit. Do we have any old solar
panels to ship out with them? Or how about building some nuclear power
stations to go with all this equipment? Still a good idea?!

Paul

[1] Videos are available at http://www.fosdem.org/2007/media/video -
and in an open format, too. (Hint to any conference people thinking of
just uploading stuff to YouTube!)
 
J

John J. Lee

Gabriel Genellina said:
En Fri, 09 Mar 2007 16:10:51 -0300, Tim Bradshaw <[email protected]> escribiÂŽó: [...]
ill-conceived idea (not because of Python, note!). The electronic
gadget people need in the developing world is a mobile phone not a
computer.

What for?
That requires a phone company, installed antennas everywhere, and
available power to charge batteries. Without forgetting you to pay
the bill, of course.
I don't think OLPC would actually help people so much, but a mobile
phone would be almost useless.
[...]

How wrong can you get?

Mobile phones have been making a significant economic impact in many
places in the third world. Sub-saharan Africa has seen huge growth in
access to mobile phones over the past few years, for example. A
recent report indicates there are now over 100 million mobile phones
in use in Africa. That's a huge change im communications from five
years ago, but more than that, since people often don't own a mobile,
but rent them by the minute from at the roadside, access levels must
be much higher than that would imply (i.e., much greater than 10% of
the continent's population).

Mobile connections are intrinsically cheaper than fixed-line networks,
can be rolled out faster, and have a disproportionately large impact
in places where such electronic communications have in the past been
absent, when compared with places like Europe and the US. For
example, farmers report that they find mobile phones valuable to get
information on market prices; without them, they would in the past
have little choice but to physically go to market and hope for the
best.

http://www.timesonline.co.uk/tol/news/world/article737130.ece


I know nothing about OLPC, but I hope they're spending lots of time
talking to children, teachers, and academics, and to anybody with a
good criticism. It must be tricky for big projects to stay connected
to reality.


John
 
J

John J. Lee

John Nagle said:
Python, on the other hand, is uphill all the way. Constant trouble
with version issues, especially with C components called from Python.
MySQLdb, M2Crypto, SSL - they all have platform/version
incompatibility problems. I just spent three days making M2Crypto
work on a new Linux server with a different Red Hat version.
Neither Python's packaging tools nor the platform's packaging
tools deal adequately with these issues.
[...]

You haven't been using mod_python, by any chance?


John
 
J

John Nagle

John said:
Python, on the other hand, is uphill all the way. Constant trouble
with version issues, especially with C components called from Python.
MySQLdb, M2Crypto, SSL - they all have platform/version
incompatibility problems. I just spent three days making M2Crypto
work on a new Linux server with a different Red Hat version.
Neither Python's packaging tools nor the platform's packaging
tools deal adequately with these issues.

[...]

You haven't been using mod_python, by any chance?


John

No, haven't started to deal with that yet. Still using
CGI. Not sure whether to use mod_python or fastcgi for the
small requests where the Python load time swamps the time
to do one SQL select and reply. Comments?

John Nagle
 
J

John J. Lee

John Nagle said:
John said:
Python, on the other hand, is uphill all the way. Constant trouble
with version issues, especially with C components called from Python.
MySQLdb, M2Crypto, SSL - they all have platform/version
incompatibility problems. I just spent three days making M2Crypto
work on a new Linux server with a different Red Hat version.
Neither Python's packaging tools nor the platform's packaging
tools deal adequately with these issues.
[...]
You haven't been using mod_python, by any chance?
John

No, haven't started to deal with that yet. Still using
CGI. Not sure whether to use mod_python or fastcgi for the
small requests where the Python load time swamps the time
to do one SQL select and reply. Comments?

mod_python relies on an unsupported feature of Python, namedly
multiple interpreters --> risk of more pain with C extensions.


John
 
G

Graham Dumpleton

John Nagle said:
John said:
[...]
Python, on the other hand, is uphill all the way. Constant trouble
with version issues, especially with C components called from Python.
MySQLdb, M2Crypto, SSL - they all have platform/version
incompatibility problems. I just spent three days making M2Crypto
work on a new Linux server with a different Red Hat version.
Neither Python's packaging tools nor the platform's packaging
tools deal adequately with these issues.
[...]
You haven't been usingmod_python, by any chance?
John
No, haven't started to deal with that yet. Still using
CGI. Not sure whether to usemod_pythonor fastcgi for the
small requests where the Python load time swamps the time
to do one SQL select and reply. Comments?

mod_pythonrelies on an unsupported feature of Python, namedly
multiple interpreters --> risk of more pain with C extensions.

As usual, those bashing up on mod_python tend not to really know what
they are talking about. :-(

Although multiple Python interpreters cannot be manipulated directly
from within a Python script, they can from the Python C API and it is
very much a feature of Python and has been for a long time.

The only issue with multiple sub interpreters in respect of C
extension modules is that implementers of those C extension modules
take the easy path and use the simplified thread API for GIL locking.
The consequence of them doing that is that their C extension module
may not work when used in anything but the first interpreter created
by Python. If instead of using the simplified thread API for GIL
locking they used other parts of the Python threading API as
appropriate and did thread lock handling properly for multiple
interpreters, there would not be an issue.

Even so, to get such a C extension module working in the context of
mod_python simply means telling mod_python to run that particular
application in the first interpreter instance by specifying the
mod_python directive:

PythonInterpreter main_interpreter

Thus, the problem is not mod_python at all, but that the C extension
modules implementer didn't bother to implement their module so as to
be usable within a system such as mod_python where multiple
interpreters are used. Further, mod_python even provides a way to work
around the problems with such third party C extension modules.

If you feel that this is not the case and mod_python is still broken
in some way, please properly explain what the problem is.

PS. Yes I do know that forcing using of main interpreter in mod_python
only helps solve this problem in mod_python 3.2 and later and did not
help with older versions.

Graham
 
J

John J. Lee

Graham Dumpleton said:
On Mar 11, 12:31 pm, (e-mail address removed) (John J. Lee) wrote: [...]
mod_python relies on an unsupported feature of Python, namely
multiple interpreters --> risk of more pain with C extensions.

As usual, those bashing up on mod_python tend not to really know what
they are talking about. :-(

Although multiple Python interpreters cannot be manipulated directly
from within a Python script, they can from the Python C API and it is
very much a feature of Python and has been for a long time.

I didn't dispute that multiple interpreters are a feature of Python.
I said that they are an unsupported feature -- at least, Martin
v. Loewis says they're "just broken", which is close enough for me:

http://groups.google.co.uk/group/co...b171/674accc133afbc96?rnum=2#674accc133afbc96

"""
In any case, it looks like that the "multiple interpreters" feature of
Python is just broken.
"""

[...]
Even so, to get such a C extension module working in the context of
mod_python simply means telling mod_python to run that particular
application in the first interpreter instance by specifying the
mod_python directive:

PythonInterpreter main_interpreter
[...]

Is it possible to ask mod_python to start separate processes to serve
requests, rather than "separate" interpreters? We couldn't see a way.


John
 
G

Graham Dumpleton

Graham Dumpleton said:
On Mar 11, 12:31 pm, (e-mail address removed) (John J. Lee) wrote: [...]
mod_pythonrelies on an unsupported feature of Python, namely
multiple interpreters --> risk of more pain with C extensions.
As usual, those bashing up onmod_pythontend not to really know what
they are talking about. :-(
Although multiple Python interpreters cannot be manipulated directly
from within a Python script, they can from the Python C API and it is
very much a feature of Python and has been for a long time.

I didn't dispute that multiple interpreters are a feature of Python.
I said that they are an unsupported feature -- at least, Martin
v. Loewis says they're "just broken", which is close enough for me:

http://groups.google.co.uk/group/comp.lang.python/browse_thread/threa...

"""
In any case, it looks like that the "multiple interpreters" feature of
Python is just broken.
"""

For mod_python at least, the issues described there do not present as
a problem because in mod_python sub interpreters are never destroyed
while the process is running. Thus as far as the implementation of
mod_python goes it is fine to key off the pointer to the interpreter
as one knows interpreters will never go away.

In the more general case I can see that it may be an issue for some
small percentage of C extension modules which may want to cache
information per interpreter. This though would only be the case if
they wanted to exclusively hold everything directly within the C code
space. Although it would perceivably slow access down, there is
nothing to stop such a module instantiating its own pseudo module
within the context of a sub interpreter using PyImport_AddModule().
This Python module could then be used to hold objects created by
PyCObject_FromVoidPtr() with access later being had by using
PyCObject_AsVoidPtr() after having looked up the object in the module.
As necessary, when creating these objects, the C extension module can
associate a cleanup function to be called when the object is destroyed
by virtue of the sub interpreter being destroyed. Thus the C extension
module would be able to cope with sub interpreters coming an going.

So, more work is required and some may be concerned about efficiency
and that a user may screw with the cached data from Python code, but
it is possible to have per interpreter information with a C extension
module.
[...]> Even so, to get such a C extension module working in the context of
mod_pythonsimply means tellingmod_pythonto run that particular
application in the first interpreter instance by specifying the
mod_pythondirective:
PythonInterpreter main_interpreter

[...]

Is it possible to askmod_pythonto start separate processes to serve
requests, rather than "separate" interpreters? We couldn't see a way.

Within the context of Apache it is possible to write modules which
could spawn off a separate daemon process to which requests could
later be passed for processing. An example of this included with
Apache is something like mod_cgid. Other examples of modules which
allow requests to be farmed off to separate processes, although they
work a bit differently, are mod_fastcgi, mod_scgi and mod_proxy_ajp.

To do something similar with mod_python isn't really practical because
of the way it hooks into more than just the response handling phase of
Apache. This concept though is being investigated for some version of
mod_wsgi after the initial version has been released. When
implemented, it would allow mod_wsgi to either handle WSGI
applications in the same style as mod_python within the Apache child
processes, or optionally farm the request off to a separate process
running either as the same user as Apache or a different user, in the
same style as mod_fastcgi and mod_scgi. The difference with mod_wsgi
would be that it would be one self contained module all managed from
Apache and would not require a separate executable or daemon process
to Apache to be run to which it would communicate with as the separate
daemon processes would ultimately just be a fork of the Apache parent
process and be running code from the Apache module itself. Also the
application scripts would be exactly the same no matter which mode it
was running in so no need to modify them in any special way to run
under the separate process.

Graham
 
J

John Nagle

Is it possible to ask mod_python to start separate processes to serve
requests, rather than "separate" interpreters? We couldn't see a way.

That's what CGI does.

John Nagle
 
J

Jorge Godoy

I meant long running processes, as I hoped was obvious from context...

Maybe FastCGI should help, then. It can run "forever" after a request has
finished so it is suitable for long running processes.
 
J

John J. Lee

Jorge Godoy said:
Maybe FastCGI should help, then. It can run "forever" after a request has
finished so it is suitable for long running processes.

Yes, we've used FastCGI too. My question was specifically about
mod_python.


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top