>> I understand. My point is that in this particular example, what the >> user perceives as ignoring the request is obtained by the >> implementation technique of treating it as an empty string. The user >> doesn't have to know about this implementation technique, of course. Guido> I think it's a poor implementation technique. :-) Opening the file to Guido> search for an empty string is very inefficient. I'm assuming that the file is going to be opened anyway, possibly to check for other search criteria. Guido> My own potential example was some kind of graph traversal algorithm, Guido> representing paths by sequences of letters (the letters labeling Guido> edges), and involving paths that are subpaths of other paths. Guido> Certainly the empty path should be considered a valid subpath of other Guido> paths. I can imagine similar applications that deal with file names Guido> BTW, a more fool-proof (though unfortunately slower) way of testing Guido> for substring containment in existing Python would be s2.count(s1) -- Guido> this returns the number of occurrences. And of course, Guido> 'abc'.count('') returns 4. That could be much slower, of course. Incidentally, one other argument that might be relevant is that in every other programming language I've ever seen that supports string searching, the null string is accepted as a search argument and is always found.
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