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

Gareth McCaughan Gareth.McCaughan at pobox.com
Sat Jul 29 09:10:43 EDT 2000


Steve Lamb wrote:

[I said:]
>> None doesn't mean "empty object". It means "no object". There's
>> a big difference, whether or not you care to recognise it. As
>> big as the difference between "no bottles" and "an empty bottle",
>> which is insignificant only if all you care about is the beer. :-)
>
>     Be hard to fool me on that.

I'm not trying to fool anyone.

> 
> type(a)
> a = None
> type(a)
> 
>     If it  were no object how come it doesn't bomb out again.  Maybe the more
> precise answer would be that I am trying to create the name a and point to
> nothing.  None is not nothing.  None /is/ something.  It is a type.  :P

Whatever it is, it isn't a type. The word "type" has a meaning
(several meanings, in fact), and for none of them is the object
called "None" in Python a type. (Although the type of None is
called <type 'None'>...)

Anyway: it's true that None isn't exactly equivalent to
"no object". (Obviously, since None is something you can
assign to variables, use as a key or value in a dictionary,
etc, etc.) But if you're going to think about it in terms
that are as naive as "empty object", then "no object" is
a lot closer, and that was what I was trying to say.

The thing Python calls "None" is not a sequence. It is
not a set. It is not a dictionary. It is not a number.
If you'd prefer it to be one of those, or to behave
like one of those without any effort on the programmer's
part, that's fine; but that isn't the preference of the
person who designed Python, it isn't mine, and I rather
suspect it wouldn't be many people's.

You say that you want to "create the name a and point to
nothing". *Why* do you want to do this? The brief description
you've given of the problem doesn't give me any clue why
Python can't easily do just what you need. (Though not
necessarily with the exact sequence of statements you want.
That's not a problem: the right way to write a Python program
isn't to write a Perl program and translate it line by line.)

                               *

The article from which you quoted that one paragraph said a
lot of other stuff. I'd be interested in your reaction to it.

                               *

I think your basic complaint could be paraphrased like this:

    "There are lots of things I've got used to Perl doing.
    Python doesn't do them. Therefore Python is weird, it's
    full of quirks, it doesn't behave the way real humans
    expect".

To which I reply: Indeed, Python is unlike Perl in many ways.
Being unlike Perl isn't in itself a quirk. You happen to find
Perl's decisions in some matters congenial; please don't
try to make out (as you seem to have been doing in other
articles) that this is because you're a Human Being and
those of us who find Python's decisions mostly more natural
are Weird Geeks, though, because that's not so.

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
sig under construction



More information about the Python-list mailing list