Perl is worse! (was: Python is Wierd!)

Steve Lamb grey at despair.rpglink.com
Thu Jul 27 12:00:12 EDT 2000


On Thu, 27 Jul 2000 08:44:12 GMT, Jonathan <theebh at yahoo.com> wrote:
>Python's syntax now seem much 'cleaner' and intuitive. But then i guess
>you all shld have known this by now:)

    All depends on your point of view, really.  I actually prefer inline REs
and so far the lack of automatic type switching in Python has nailed me a few
times on a fairly simple script.  I prefer Perl because I don't have to think
about what the data is specifically.  Either it is scaler, a list or a hash.
Beyond that, it takes care of it.  In the script I just wrote Python had a
hissy fit when I had something like:
match = re.search(r'(1)(2)(3)',string)
foo = match.group(3)
for x in range(1,foo):
  print x

    Range returns an error because of a bad type being stuffed into it.  Perl
at least sees that it is a number and makes the conversion itself.  I had to
get around it by changing the foo assignment line to:
foo = int(match.group(3))

    But then that caused a problem because the regex I was using could either
return 2 or 4 matches.  So now the code looks like:

var1 = int(match.group(1))
var2 = int(match.group(2))
var3 = match.group(3)        # This is never an int, always a string.
if match.group(4):           # need to check since you cannot
  var4 = int(match.group(4)) # int() a None

    Maybe I am missing something, I mean this is my first script after "hello
world" and I've only got the Beazley book but I never hit those problems in
Perl.

    I personally don't think one is better than the other and to catagorically
state so is... limiting one's view, IMHO  There are things I like in Perl a
lot more than my experience with Python and there are things I like in Python
more than in Perl.  To counter this example of what I feel is a shortcoming in
Python I have to stress that I also, even with my limited experience with
Python, am finding things in Perl that I find sub-optimal compared to Python.

    I plan on using both until such a time when either something exceedingly
superior comes along or the designer(s) of either language mangle it so bad
that my love for the language is mushed.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------



More information about the Python-list mailing list