Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type
Paul Rubin
http
Sat Aug 27 00:05:00 EDT 2005
Steve Holden <steve at holdenweb.com> writes:
> Of course. But onc you (sensibly) decide to use an "if" then there
> really isn't much difference between -1, None, () and sys.maxint as
> a sentinel value, is there?
Of course there is. -1 is (under Python's perverse semantics) a valid
subscript. sys.maxint is an artifact of Python's fixed-size int
datatype, which is fading away under int/long unification, so it's
something that soon won't exist and shouldn't be used. None and ()
are invalid subscripts so would be reasonable return values, unlike -1
and sys.maxint. Of those, None is preferable to () because of its
semantic connotations.
More information about the Python-list
mailing list