Choosing a programming language as a competitive tool

Alex Martelli aleaxit at yahoo.com
Mon May 7 04:55:45 EDT 2001


"Isaac To Kar Keung" <kkto at csis.hku.hk> wrote in message
news:7iitjdren1.fsf at enark.csis.hku.hk...
    ...
> Right, vector really has its mathematical meaning.  If you can understand
> that vectors are not meant to be just 2D or 3D vector, you can understand
> why vector means an array.  But of course, I don't quite understand how a
> mathematical vector can be "resized".

Presumably by projecting it onto a space of lower dimensionality, or
embedding it into a space of higher dimensionality.

E.g., say that originally you know that a vector is (2, 4) -- in 2
dimensions, of course, as it has 2 components.  Now, you learn that
the 2-D space where that original vector lie is the plane Z=0 in
3-D space.  Ok, so, to perform further operations using that vector
in 3-D space, you "resize" it to (2, 4, 0).

Of course, in maths, you don't "change" an entity -- entities are
pretty much unchangeable there; rather, you define an injective
function which gives you the new entities corresponding to the
previous ones.  But in programming (excepting most FP:-) it's
quite normal to deal with "mutable entities", so I would hope that
_vectors_ in particular being mutable would be no more of a
problem than other kinds of entities being mutable.


> Why don't just call it an array, I don't really know.  Perhaps its because
> the name comes from STL targeting C++, and for C++ arrays already means
> something else.

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


> But so what?  Every language has its own terms.  Who else use "tuple" and

SQL was the first widespread programming language using the
term "tuple" in this way, I believe -- but it's really a widespread
word and concept in computer science and math, used in such
languages as Haskell, Linda in all its variants, ML, ...

> "dictionary" as used in Python?

I'm not aware of any programming language predating Python that
calls its mappings "dictionaries" -- however, I don't believe
that "dictionary" was used to describe different data structures
in any widespread pre-existing language, either.  I believe
Microsoft's "Scripting.Dictionary" is relatively recent ('94?),
and it's close enough to a Python dictionary in functionality
and approach that one might wonder about common roots... were
those not obviously evident in the English language meaning:-).

> Why call it a "field" or "method"?  What is

Rather widespread terms, these... I suspect they come
from Simula 67 and Smalltalk respectively, but am not sure.

> a "variable"?

Ditto, and in this case the root is quite clear -- Fortran
(later called Fortran I), 1954.  Fortran stood for FORmula
TRANslator, and its "variables" were meant to be what you
would use for what were originally variables (in the normal
mathematical sense of the word) in the formula you were
"translating" (transcribing, transliterating, ...).

> You really have to get used to it anyway.

Sure, but that doesn't mean there aren't nomenclature
choices that are more or less appropriate -- by making
the "getting used" easier, and reminding one of just
the right underlying concepts, or vice versa.

Much will depend on a person's cultural background, of
course -- e.g., calling a dictionary "a hash" may be OK
if the average user is familiar with hash-tables and gets
reminded of various characteristics (O(1) access, no
intrinsic order), but it may make a hash of things
when talking to somebody who thinks a hash is "#" and
is reasonably perplex about that character having
nothing to do with the case:-).

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


Alex






More information about the Python-list mailing list