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

Alex Martelli alex at magenta.com
Sun Jul 30 05:41:15 EDT 2000


"Steve Lamb" <grey at despair.rpglink.com> wrote in message
news:slrn8o75fq.fjt.grey at teleute.rpglink.com...
> On Sun, 30 Jul 2000 01:21:09 +0200, Alex Martelli <alex at magenta.com>
wrote:
> >>     How many would say that abc is a sequence.  ;P
>
> >Most would, of course -- just ask what comes next, and anybody
> >with positive IQ will guess 'd'.
>
> 1
>
> What comes next?

Now THAT is a poser.  In Europe at least, for example, if you're looking
for a house you know that what's likely to come next is 3, then 5, etc;
odd-numbered addresses are on one side of the road, even-numbered ones
on the other (two separate sequences).  If you're taking a bus at the
stop I often use, what's likely to come next is 27 -- it most often
comes by a minute or two after 1 has come and gone.  If you're scanning
an alphabetized list, such as a typical book's index, what's likely to
come next is 10.  Etc, etc.

In other words, a single item by itself just does not give enough
context to make anything but a wild-assed guess.  There is no sequence
yet, so you must pick, more or less at random, one of the several
typical sequences that start with that single item.  Giving two
items is already much better, and three, very often, give enough
indications -- not to determine _univocally_ the rest of the
sequence, of course, but still very often to indicate what is MOST
LIKELY to come next (a typical question in IQ tests).

Be particularly careful with *numbers* -- confusing them with
strings is a very high risk here.  Given, for example, 123, it's
anybody's guess whether this is a number (one more than 122, one
less than 124) or a string, i.e. a sequence of three characters,
in which case 4 is reasonably likely to be the next one.  Isn't
it fortunate that good programming languages don't let you suffer
from that pernicious ambiguity, by distinguishing 123, the number,
from '123', the sequence-of-characters (string)?-)


Alex






More information about the Python-list mailing list