Learning new languages is frustrating, esp. when you're comparing them to what you already know: Perl.
Here's something I don't like about Python: the need for ending sub calls with (). I hate it.
Now, I know it's about something being 'callable' and without the params, you're returning the sub, not calling it. It's not intuitive for my brain. I don't like it.
Perl++ for never making me put () after method names or having to think about what it's doing.
Consider:
#!/usr/bin/perl
use warnings;
use strict;
my %dispatch = (
foo => "bar",
foo() => "bar",
);
sub foo {
return "FOO";
}
print keys %dispatch;
But in general I agree (especially with regards to chaining method calls).
Cheers,
-- Douglas Hunter
P.S. Does anyone know how to preserve whitespace inside code sections on use.perl?
Re:sometimes Perl needs that () hint
Aristotle on 2008-10-19T22:52:33
Use
<ecode>
tags.