Migrating to perl?

Joel Ricker joejava at dragonat.net
Fri Jan 5 00:30:05 EST 2001


Wow, great answers for a probably frequent question.  Thanks everyone!

Skip Montanaro wrote in message ...
>
>    Joel> Are the modules and add-ons as good as perl (ie, Database -- I'm
>    Joel> primarily interested in MySQL, CGI, Graphics).
>
>I use MySQL all the time from Python.  It's pretty straightforward:
>
>    import MySQLdb
>    conn = MySQLdb.Connection(...)
>    c = conn.cursor()
>    c.execute("select id,name from performers where name like "Paul%")
>    for (pid,name) in c.fetchall():
>        print pid, name


I'm not sure about what the cursor() method does but I follow the rest.  A
prepare statement maybe?  But I follow the rest of you code and it looks
nice and simple.  Yea!

>There is a CGI module that's also fairly easy to use, though it is
>undergoing some close scrutiny by the experts to see if it can be improved
>upon.  There are also a number of CGI replacements like FastCGI, PyApache,
>mod_python and mod_snake (the last three being mod_perl analogs).


I thought of the question about security and the need for taint modes but
then I realized since there may not be system calls like `del *.*` there
might not be a need for it.  I'm sure that if Python is in general use as a
CGI language then those issues have been cleared up.  Are there any thing
you have to watch for like running in taint mode in perl?

>"Graphics" covers a multitude of things, so I can only guess what you might
>be interested in.  There are Python bindings for VTK
>(http://www.kitware.com/) if you are looking for sci-viz and 3d rendering
>sorts of things.  I believe there is a gnuplot interface module floating
>around.  PythonWare (http://www.pythonware.com/) developed and distributes
>PIL (the Python Imaging Library).  I believe there's something called (I
>think) Piddle for doing device-indepndent 2d stuff.


Yes it is rather vague.  Opps.  My main reason is I'm working on a web based
game and need to build a map image dynamically.  Its a hex based map and I
worked hard with the help of  geometry expert on another group to make it
work right.  I would hate to have to build a module like that from scratch,
especially since graphic file standards are not exactly my forte.  I only
have a vague understanding of their inner workings.

>Python's infrastructure for module distribution and installation is not as
>mature as Perl's CPAN, but there you can search the Vaults of Parnassus
>(http://www.vex.net/parnassus/) for third-party modules and there are
>packages like distutils that are moving things in the right direction.  The
>vast majority are easily installed.
>
>Python is also somewhat more portable that Perl.  There are fully
>functioning Windows and Mac ports.  The lag time between the release of a
>new Unix version and corresponding Windows and Mac versions is pretty short
>(generally a couple weeks to a month at most).


Sounds great.  Perl always seems to be very unix-centric which tends to bug
me.  Only one book I've gotten on Perl went for a cross-platform approach to
perl (Perl Black Book).  Another question.  I just downloaded Activestates
build for Python.  I went there first since I've got accustomed to their
services.  Is a good build?  As good as Pythonlabs?  Better?

>Your comment about Perls multitude of contexts really rings true with me.
I
>use Perl in the guise of Mason these days to maintain the Mojam.com
website.
>(Mason is great, by the way.  I just wish it used Python. ;-) A couple
weeks
>ago I thought I had all the reference stuff figured out, but then this
>morning it all came crashing down on me (again).  Ah well, back to the
>perlref manpage...


No kidding.  I just but Object Oriented Perl by Damian Conway and I thought
I had the idea and concepts down and by the end of the third chapter it all
came crashing down.  Things are working that shouldn't and vice versa.  I
probably need to take a look at the perlref manpage myself but I'm
suspecting it may be the new build from Activeperl but I'm getting too
fustrated to dig into it.  I could post for help but I already know the
answer that I'll be given:

perldoc perltoot

BTW, I noticed when I first looked around this newsgroup there was a mention
of a couple of options of using Perl modules with Python.  Minotaur I think
it was called.  Could you use that to wrap Python around Mason?  I agree,
its a nice package.   I really don't have a problem with perls packages but
writing my own or doing anything off the beaten path is getting to be too
much like work -- making the hard things harder.

Joel






More information about the Python-list mailing list