A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-August/017310.html below:

Generalizing "in" to pairs of sequences

[Python-Dev] Re: Generalizing "in" to pairs of sequences [Python-Dev] Re: Generalizing "in" to pairs of sequencesBarry A. Warsaw barry@zope.com
Sun, 26 Aug 2001 23:07:30 -0400
    ESR> You're right.  But since a string can't be an element of a
    ESR> string, the case I'm really interested in would still work.

    KY> It's arguable.  A character can indeed be an element of a
    KY> string, and in Python characters are one-character strings.
    KY> So this violates

    KY>     x in s <=> there exists i such that s[i] == x

    KY> You could argue that strings should have special behaviour for
    KY> "in" to support the common case of finding a substring; then
    KY> you would have to argue on grounds of "practicality beats
    KY> purity".

And against TOOWTDI:

>>> 'cabcd'.find('ab') >= 0
1
>>> 'cabcd'.find('xx') >= 0
0

-Barry



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4