[Python-Dev] string.find() again (was Re: timsort for jython)

Andrew Koenig ark@research.att.com
Wed, 14 Aug 2002 16:34:55 -0400 (EDT)

Greg> re in string
Greg> should be made to work too, where re is a regular
Greg> expression object?
>> Then the core language would have to know about regular
>> expressions, right?

Guido> Um, yes.  That kills the idea (unless you want to write this as
Guido> "string in re", which almost makes sense :-).

Or unless the notion of ``x in y'' could be were reinterpreted
in terms of a new attribute that strings, chars, and regexps
would share.

That is, I can imagine defining ``x in y'' anologously to ``x+y''
as follows:

   If x has an attribute __in__, then ``x in y'' means ``x.__in__(y)''

   Otherwise, if y has an attribute __rin__, then ``x in y'' means

and so on.

This is an example of the kind of situation where I imagine type
categories would be useful.