Matlab vs Python (was RE: Discussion: Introducing new operators for matrix computation)
Moshe Zadka
moshez at math.huji.ac.il
Tue Jul 18 02:29:34 EDT 2000
On Mon, 17 Jul 2000, Huaiyu Zhu wrote:
> Consider the proposal of having two classes, Matrixwise and Elementwise,
> with methods to cast to each other. I don't know why
>
> (a.E()*b.E()).M()*(c.E()*d.E()).M()
>
> would be more preferable to
>
> (a.*b)*(c.*d)
For the same reason
import sys, re
r = re.compile("a(.*)z")
while 1:
line = sys.stdin.readline()
if not line:
break
m = r.search(line)
if m:
print m.group(1)
To:
while(<STDIN>) {
print $1 . "\n" if /a(.*)z/;
}
It's more verbose, and people are able to understand it without learning
weird corners of the language. (BTW: as a former Perl hacker, I find the
Perl code *extremely* readable, and I spend more time understanding the
Python code. But that doesn't change the fact that Perl took me longer to
master then Python, and even then I didn't really understand Perl. For
example, could I lose the ";" in the Perl code? I think so, but I'm not
sure)
--
Moshe Zadka <moshez at math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez
More information about the Python-list
mailing list