[Lancaster] To Python, or not to Python?
andy baxter
andy at earthsong.free-online.co.uk
Thu Apr 9 13:27:53 UTC 2009
Rosalind Mitchell wrote:
> I'm not in a hurry. I like working in Perl and I had a crack at Ruby
> for a while and that's nice but I still prefer Perl.
>
> But is there a good reason for learning Python? And would anybody like
> to try to convince me of its merits over Perl?
>
I only have a little experience with Python, but I like it so far and
have decided to use it for new projects for a while just to learn the
language. The things I like compared to perl are:
- More built in high level data types. E.g. Set, which lets you write
code like:
#!/usr/bin/python
import sys
name=sys.argv[1]
friends=set(("fred","jim","henry"))
family=set(("jane","hugh","lisa"))
colleagues=set(("jim","frank","sue"))
iknow=friends.union(family.union(colleagues))
if name in iknow:
print "you know",name
else:
print "you don't know",name
- object orientation is built in from the start, rather than hacked on
later in the odd way perl does it. (From what I remember)
- the syntax is less obscure than perl. (Though this may not be an
advantage if you already know perl)
- compiling to byte-code should make it faster than perl for big
projects (I think).
One thing perl has going for it though is the huge number of third party
modules in cpan. There are quite a few python modules, but not so many
as perl I think.
andy
More information about the Lancaster
mailing list