[Tutor] Are you allowed to shoot camels? [kinda OT]

Liam Clarke cyresse at gmail.com
Thu Feb 3 01:42:10 CET 2005

> I don't find it that bad. Ruby does it as well, and it's perfectly
readable. It's more or less equivalent as if condition: and
if(condition): both being valid in Python.

Yeah, but you'd never call a function foo like this- 

 x = foo

in Python. It's just good to be able to say that a function always has
<some rule here>.
That improves readability (imao).

 >You sure of that? I was under the impression that len(moddirList) in
Perl was $moddirList (@moddirList is the list itself).

Well, my one's correct, but I think yours is also. And this is what gets me. 

@mod = (1,2,3)
$mod = 3
$mod[0] = 1

Is inconsistent. Or at least, the logic behind this is not immediately
apparent to me. I'm always open to illumination on these things

>> if ( not $d eq "a" && not $d eq "c") = False for $d = "b"
>> if ($d ne "a" && $d ne "c") = True

>This probably has to do with operator precedence. It's been lifted
from C, so chances are that && has a higher precedence than eq. Use

Ah... Ironic, I got misled by TMTOWTDI. I figured that if not x=="a"
and not x == "c" evaled as True in Python, and "if (not $d eq "a")"
evaled as True in Perl, that
if ( not $d eq "a" && not $d eq "c") would also eval as true. 
Of course, what's even weirder to me is that 
if ($d ne "a" && $d ne "c") does eval as True, as far as I can see, 

'$d ne "a"' is the same as d != "a" in Python, which is the same as
'if not d == "a"', which, logically, would mean that $d ne "a" is the
same as 'if(not $d eq "a") in which case both tests should handle the
addition of an AND the same.

Once again, illumination is welcomed, as I have a finally that some
subtlety of Boolean logic is eluding me, and a 'x != a' test is
different to 'if not x == a' in a small but significant way.

Max - the foo > std.txt thing explains it, but what about @dude =
<FILE>, where do the brackets originate from?

This is another issue I'm having with Perl as opposed to Python - Perl
is very much written by *nix users for *nix users, it's implementation
of *nix conventions shows, including the
`` things. Whereas (correct me if I'm wrong), but Python was written
by *nix users for everyone. Python seems very non-OS-denominational in
it's current incarnation, it may have been very *nix orientated prior.

So here comes me, the guy who installed Linux once, failed to see the
big deal and uninstalled it. Up until 3 months ago, my comp was used
for gaming, pure and simple, me being a certified Day of Defeat freak,
and so Windows has always best served my purpose.

Now, I want to programme, so I have to learn Unix conventions to use a
crossplatform language!  It's like asking *nix users to sign a
Microsoft EULA!! (Well, not as bad, but still as anathemic.)

>Fast forward to last summer. In the span of 1 week, I discovered both
Python and Ruby. Fell in love with both and immediately ditched Perl.

How's Ruby? I bookmarked the homepage, but never got around to looking at it.

Oh, and I will say this - Perl > Java (and that's an inequality test,
not a redirection of output)


Liam Clarke

'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.

More information about the Tutor mailing list