[Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-05-31 Thread Raymond Hettinger
ISTM, the whole reason people are asking for a String ABC is so you can write isinstance(obj, String) and allow registered string-like objects to be accepted. The downside is that everytime you want this for a concrete class or type, it is necessary to write a whole new ABC listing all of the r

Re: [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-05-31 Thread Guido van Rossum
I'm willing to meet you halfway. I really don't want isinstance(x, str) to return True for something that doesn't inherit from the concrete str type; this is bound to lead to too much confusion and breakage. But I'm fine with a String ABC (or any other ABC, e.g. Atomic?) that doesn't define any me

Re: [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-05-31 Thread Nick Coghlan
Raymond Hettinger wrote: If we don't do this, then String won't be the last request. People will want Datetime for example. Pretty much any concrete type could have a look-a-like that wanted its own ABC and for all client code to switch from testing concrete types. If I remember rightly, th

Re: [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-05-31 Thread Guido van Rossum
On Sat, May 31, 2008 at 6:41 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > From: "Guido van Rossum" <[EMAIL PROTECTED]> >> I'm willing to meet you halfway. I really don't want isinstance(x, >> str) to return True for something that doesn't inherit from the >> concrete str type; this is bound t

Re: [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-05-31 Thread Raymond Hettinger
From: "Guido van Rossum" <[EMAIL PROTECTED]> I'm willing to meet you halfway. I really don't want isinstance(x, str) to return True for something that doesn't inherit from the concrete str type; this is bound to lead to too much confusion and breakage. Probably true. It was an attractive id

Re: [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-05-31 Thread Raymond Hettinger
[Raymond] I propose the following empty abstract classes: String, Datetime, Deque, and Socket. [GvR] Sounds like a mini-PEP is in place. It should focus on the code to actually define these and the intended ways to use them. Okay, will run a Google code search to see if real code exists

Re: [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-05-31 Thread Guido van Rossum
On Sat, May 31, 2008 at 8:09 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Raymond] >>> >>> I propose the following empty abstract classes: String, Datetime, >>> Deque, >>> and Socket. > > [GvR] >> >> Sounds like a mini-PEP is in place. It should focus on the code to >> actually define th

Re: [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-06-01 Thread Paul Moore
2008/6/1 Guido van Rossum <[EMAIL PROTECTED]>: >> The case for String has already been made. > > Actually I'm not sure. One you know that isinstance(x, String) is > true, what can you assume you can do with x? [...] > Right. I'm now beginning to wonder what exactly you're after here -- > saying tha

Re: [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)

2008-06-01 Thread Guido van Rossum
On Sun, Jun 1, 2008 at 6:57 AM, Paul Moore <[EMAIL PROTECTED]> wrote: > 2008/6/1 Guido van Rossum <[EMAIL PROTECTED]>: >>> The case for String has already been made. >> >> Actually I'm not sure. One you know that isinstance(x, String) is >> true, what can you assume you can do with x? > [...] >> Ri