[Python-3000] Abilities / Interfaces

Steven Bethard steven.bethard at gmail.com
Thu Nov 23 05:38:09 CET 2006


On 11/22/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Steven Bethard wrote:
> > So I would have expected something like:
> >
> >     str.lower[MyStringType] = MyStringType.lower
> >     str.split[MyStringType] = MyStringType.split
>
> But that would only work if everyone switched to
> writing str.lower(s) everywhere instead of s.lower(),

I don't think so, but perhaps I misunderstood the proposal.  I thought
it would just rely on someone defining a String Interface as the union
of ``str.lower``, ``str.split``, etc.  Then to figure out what to do
with your ``string_or_list`` argument, you'd test it against this
String Interface. You could then freely make calls like ``s.lower()``,
knowing that they were calling the equivalent of ``str.lower()``.

Steve
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list