[Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)
Guido van Rossum
guido at python.org
Mon Jun 2 00:57:09 CEST 2008
On Sun, Jun 1, 2008 at 6:57 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> 2008/6/1 Guido van Rossum <guido at python.org>:
>>> 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 that something is an "X" without saying anything about an API
>> isn't very useful. You need to have at least *some* API to be able to
>> do anything with that knowledge.
> Apologies to Raymond if I'm putting words into his mouth, but I think
> it's more about *not* doing things with the type - a String is a
> Sequence that we don't wish to iterate through (in the flatten case),
> so the code winds up looking like
> for elem in seq:
> if isinstance(elem, Sequence) and not isinstance(elem, String):
> recurse into the element
> deal with the element as atomic
I thought that was he meant too, until he said he rejected my offhand
suggestion of Atomic with these words: "Earlier in the thread it was
made clear that that atomicity is not an intrinsic property of a type;
instead it varies across applications [...]"
> This implies that other "empty" abstract types aren't useful, though,
> as they are not subclasses of anything else...
There's a thread on this out now I believe.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev