advice for perl expert wanting to learn python

Z

Zeljko Vrba

Now, why would I like to learn Python: because of IronPython port to CLR.
Perl port to CLR doesn't seem to be coming soon. First Perl6 for Parrot has
to be written, and then other backends..

What's the easiest way of learning python knowing perl? Is there somewhere
a 'how-to' cookbook with parallel examples of frequent idioms in perl and
python?

And most important thing, how does Python deal with database connectivity?
Is there a single API (akin to DBI) for connecting to databases?

How does Python support the following databases:
- Oracle
- Postgres
- MySQL
- SQLServer (maybe using freetds?)
- ODBC connectivity (connecting to MS Access)
 
S

Stano Paska

Zeljko said:
Now, why would I like to learn Python: because of IronPython port to CLR.
Perl port to CLR doesn't seem to be coming soon. First Perl6 for Parrot has
to be written, and then other backends..

What's the easiest way of learning python knowing perl? Is there somewhere
a 'how-to' cookbook with parallel examples of frequent idioms in perl and
python?
http://pleac.sourceforge.net/


And most important thing, how does Python deal with database connectivity?
Is there a single API (akin to DBI) for connecting to databases?

Yes, python has defined single API
How does Python support the following databases:
- Oracle
- Postgres
- MySQL
- SQLServer (maybe using freetds?)
- ODBC connectivity (connecting to MS Access)

I have tried MySQLdb package and mdb connectivity through
win32com.client package.
I read about Postgres and Oracle connectivity...

Stano Paska.
 
R

richard

Zeljko said:
What's the easiest way of learning python knowing perl? Is there somewhere
a 'how-to' cookbook with parallel examples of frequent idioms in perl and
python?

A good start might be:

http://www.python.org/doc/Intros.html

under the "Introductions for programmers" heading.

Then there's http://www.python.org/doc/Comparisons.html#perl which has
direct comparisons.

And most important thing, how does Python deal with database connectivity?
Is there a single API (akin to DBI) for connecting to databases?

There is a DB-API standard, which is implemented by the various connectors.

How does Python support the following databases:
- Oracle
- Postgres
- MySQL
- SQLServer (maybe using freetds?)
- ODBC connectivity (connecting to MS Access)

Well.


Richard
 
D

David Fraser

Zeljko said:
Now, why would I like to learn Python: because of IronPython port to CLR.
Perl port to CLR doesn't seem to be coming soon. First Perl6 for Parrot has
to be written, and then other backends..

What's the easiest way of learning python knowing perl? Is there somewhere
a 'how-to' cookbook with parallel examples of frequent idioms in perl and
python?

And most important thing, how does Python deal with database connectivity?
Is there a single API (akin to DBI) for connecting to databases?

How does Python support the following databases:
- Oracle
- Postgres
- MySQL
- SQLServer (maybe using freetds?)
- ODBC connectivity (connecting to MS Access)

I have used Oracle, SQLServer and Access via ADO - try adodpapi.sf.net
which is a wrapper for ADO to the Python DB-API.
But note that you may well not be able to use any of this database stuff
from IronPython

David
 
H

Harry George

For experienced scripters, I find Beazley's "Python Essential
Reference" is excellent. You already know what you want, just need to
see how Python does it, and don't need a lot of handholding. Get a
copy of "Python Cookbook" too, and scan that. Then rewrite one of
your exsiting perl scripts.

An interesting variant on that is my pyperlish module, at
http://www.seanet.com/~hgg9140/comp/index.html

You can either use it as-is, or read the code to see how to emulate
perl in python. NOTE: I do not recommend using pyperlish once you get
the hang of python.

I have used Oracle, SQLServer and Access via ADO - try adodpapi.sf.net
which is a wrapper for ADO to the Python DB-API.
But note that you may well not be able to use any of this database
stuff from IronPython

David

More cross-platform and cross-DBMS is to code to the DB-API 2.0:
http://www.python.org/topics/database/
 
M

Marcel van den Dungen

Zeljko Vrba said:
Now, why would I like to learn Python: because of IronPython port to CLR.
Perl port to CLR doesn't seem to be coming soon. First Perl6 for Parrot has
to be written, and then other backends..

What's the easiest way of learning python knowing perl? Is there somewhere
a 'how-to' cookbook with parallel examples of frequent idioms in perl and
python?
See the Perl/Python phrasebook:
http://www.python.org/moin/PerlPhrasebook

-- Marcel
 
K

Keith Farmer

David Fraser said:
Zeljko Vrba wrote:
I have used Oracle, SQLServer and Access via ADO - try adodpapi.sf.net
which is a wrapper for ADO to the Python DB-API.
But note that you may well not be able to use any of this database stuff
from IronPython

Assuming you find yourself working with .NET -- as you would with
IronPython -- I would expect it to have access to the stock database
namespaces under whatever environment you're in: under MS's
implementation of .NET, System.Data.* (same under Mono?). This would
be the most likely line, since there's a lot of prior work in .NET
that targets that namespace, including UI controls.

For documentation, search for "ADO.NET". It's actually a pretty good
framework, and doesn't require a database connection to make use of it
(ie, you want an in-memory database, but don't need persistent
storage).

I don't know what Jim's planning to do with the Python db api, but
between the two, I'd personally use ADO.NET when available. I'd
suggest the IronPython email list (www.ironpython.org) for more
information.
 
D

David Fraser

Keith said:
Assuming you find yourself working with .NET -- as you would with
IronPython -- I would expect it to have access to the stock database
namespaces under whatever environment you're in: under MS's
implementation of .NET, System.Data.* (same under Mono?). This would
be the most likely line, since there's a lot of prior work in .NET
that targets that namespace, including UI controls.

For documentation, search for "ADO.NET". It's actually a pretty good
framework, and doesn't require a database connection to make use of it
(ie, you want an in-memory database, but don't need persistent
storage).

I don't know what Jim's planning to do with the Python db api, but
between the two, I'd personally use ADO.NET when available. I'd
suggest the IronPython email list (www.ironpython.org) for more
information.

The disadvantage of using ADO.NET is that you'll lose the portability
advantages of the Python db API (i.e. you'll only be able to use the
code on IronPython).
The correct approach is to write a DB API-compatible wrapper for ADO.NET
:) (as has been done for ADO)

David
 
B

Beeyah

Harry George said:
For experienced scripters, I find Beazley's "Python Essential
Reference" is excellent. You already know what you want, just need to
see how Python does it, and don't need a lot of handholding. Get a
copy of "Python Cookbook" too, and scan that. Then rewrite one of
your exsiting perl scripts.

OTOH, It should be a crime to purchase the Python Developer's Handbook
[1]. I'm glad I only paid six dollars for a used copy, because its a
load of crap.

[1] http://makeashorterlink.com/?H10123029
 
A

Aahz

I'm surprised nobody mentioned Martin Brown's book "Perl to Python
Migration".

The reviews indicate that although it has a lot of typos it is useful.

Well, that is not a review I would make. I think it's just a couple of
notches better than "horrible" -- I believe any Perl programmer would be
much better off with a regular Python book.
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"To me vi is Zen. To use vi is to practice zen. Every command is a
koan. Profound to the user, unintelligible to the uninitiated. You
discover truth everytime you use it." (e-mail address removed)
 

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,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top