Python "why" questions

Russ P. russ.paielli at gmail.com
Sun Aug 22 03:23:58 EDT 2010


On Aug 21, 1:33 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote:
> > Most programmers probably never use vectors and matrices, so they don't
> > care about the inconsistency with standard mathematical notation.
>
> Perhaps you should ask the numpy programmers what they think about that.

Why would I care in the least about something called "numpy"?

> Vectors and matrices are just arrays, and the suggestion that most
> programmers don't use arrays (or array-like objects like lists) is
> ludicrous.

But the vast majority of arrays are not vectors or matrices in the
mathematical sense. And the vast majority of programmers who use
arrays have no clue about vectors and matrices in the mathematical
sense. Ask your typical programmer what an SVD is.

> > And yes, I understand that zero-based indexing can be slightly more
> > efficient. That's why I think it's appropriate for low-level languages
> > such as C. However, I think one-based indexing is more appropriate for
> > high-level languages.
>
> Only if your aim is to reduce the learning curve for newbies and non-
> programmers, at the expense of making it easier for them to produce buggy
> code.

If you're suggesting that one-based indexing makes it easier to
produce buggy code, I think you must be smoking something.

> That's a defensible choice. I'm a great fan of Apple's Hypercard from the
> late 80s and early 90s, and it used one-based indexing, as well as
> English-like syntax like:

Python is a high level language, and high-level languages have many
features that make it easier for newbies as well as experienced
programmers at the expense of extreme efficiency. But the array
indexing in Python is a throwback to C: it is zero-based and uses
square brackets. Say what you will, but both of those aspects just
seem wrong and awkward to me. However, I've switched from Python to
Scala, so I really don't care. You guys can have it.




More information about the Python-list mailing list