Why should I switch to Python?
Harry George
hgg9140 at seanet.com
Thu May 11 18:31:38 EDT 2000
Paul Winkler <slinkp23 at yahoo.com> writes:
[snip]
>
> What I miss from perl: I'd say using perl as a shell scripting
> language is faster. Python has all the same features but they're
> often implemented as functions or classes in the standard library,
> rather than as special punctuation, so there's more typing to do.
> And if you learn both languages from the O'Reilly "Learning P*"
> books, you have to get farther into "Learning Python" before you
> find out how to do those things, as compared to "Learning Perl".
> OTOH, you've learned a lot more about python than you have perl if
> you finish both books.
>
See pyperl at:
http://www.seanet.com/~hgg9140/comp/index.html
You just use your perl books to write python shell scripts. It is
crude but works for me and other ex-perl-istas in our group. I
especially like:
1. file operators:
if p.e(myfile) and p.l(myfile):
#do something to the link file
2. regular expressions:
if p.m(r'ABC\s+([A-Z]+)',line):
#use p.PREMATCH, p.MATCH, p.POSTMATCH, p.S1....p.S9
3. in-line expansion of $ and @
print p("hello $name, we have @things on the menu")
--
Harry George
hgg9140 at seanet.com
More information about the Python-list
mailing list