namespace issue?

Michael Powe michael at trollope.org
Fri Jun 22 07:43:26 CEST 2001


>>>>> "Donn" == Donn Cave <donn at u.washington.edu> writes:

    Donn> Quoth Michael Powe <looie+gnus at aracnet.com>: ...  | So now
    Donn> the question is, 'why'?  Am I misusing the string.find() |
    Donn> function? Okay, string.find() returns -1 when the string is
    Donn> not found, | which would seem to be what I expected, a false
    Donn> result.  Maybe python | doesn't treat -1 as false?  Well,
    Donn> I'll try being explicit and testing | for -1 return.  I
    Donn> probably have just confused myself hopelessly.

    Donn> | Thanks for the ... clue.  I saw a great line in an email
    Donn> today -- "Is | that the clue phone ringing?  I think it's
    Donn> for you."  And I think I'll | go answer it.

    Donn> You heard the phone ring, picked it up, and heard "Maybe
    Donn> python doesn't treat -1 as false?"  It might be worth your
    Donn> trouble to check that out.  There are a number of different
    Donn> values that test false in Python, and though different they
    Donn> tend to have something in common.  -1 doesn't fit the
    Donn> pattern.

Apparently so.  I'm used to C, in which any return value that is not
positive is false.  I'm afraid there are a number of "features" like
this in python which don't strike me as wonderful.  But, I shall
soldier on.

mp

-- 
  Michael Powe                                 Portland, Oregon USA
'Unless we approve your idea, it will not be permitted, it will not be
allowed.'  -- Hilary Rosen, President, Recording Industry Association
of America



More information about the Python-list mailing list