Choosing a programming language as a competitive tool

Isaac To Kar Keung kkto at csis.hku.hk
Mon May 7 22:48:43 EDT 2001


>>>>> "Alex" == Alex Martelli <aleaxit at yahoo.com> writes:

    Alex> But in programming (excepting most FP:-) it's quite normal to deal
    Alex> with "mutable entities", so I would hope that _vectors_ in
    Alex> particular being mutable would be no more of a problem than other
    Alex> kinds of entities being mutable.

In fact, there are few human beings who naturally think in references.
Instead of saying "there are 50 mails in your mailbox", Python says "there
are n mails in your mailbox, where n is a reference pointing to an object
50".  This is all the problems with mutability.  C and C++ don't have big
mutability problems, because you can express the former nicely.

But I'd still put it this way: unnatural things WILL be there until you put
an entry into your mental dictionary that says "Python list => a contiguous
piece of computer memory storing references to other objects".  The same
holds for other entities: "Computer programming variables => a piece of
computer memory holding one conceptual 'thing'", "Python variable => an
entry in a namespace dictionary holding a reference", "Python Tuples => an
unchangable Python list", etc.  I've got into Python for less than a month,
and my background being other programming languages.  I don't see any way to
make things more natural than just putting more entries into my glossary
list.  Yes, good naming of concepts makes it easy to start off, but once you
are here for a few days, the naming really doesn't matter unless it is
really very bad.

    Alex> For Python too -- see standard module array, which defines
    Alex> _homogeneous_ "vectors".

In Python there are "lists" before "array".  What I don't understand is why
they are not called "array" and "packed_array".  I think its okay, though.

    Alex> but it may make a hash of things when talking to somebody who
    Alex> thinks a hash is "#" and is reasonably perplex about that
    Alex> character having nothing to do with the case:-).

I still won't object "hash".  It won't convey other meaning in that context,
so it is fine.  But if you call it a "program", it will be another story. ;p

    Alex> I opine that most of Python's lexical choices are just fine,
    Alex> "list" being the only one to which I raise mild objections...

So list is special.  It can convey a wrong idea to a casual user to think
that range(1,1000000)[1:] and del(range(1, 1000000), 5) are efficient.
Still I'd think that it is okay: conceptually that kind of things can be
done, it is just not very efficiently.  And there is no reason why I can't
make my own "linked list" type that use copy-on-write to make this efficient
(while making list indexing terribly slow ;p).

Regards,
Isaac.



More information about the Python-list mailing list