A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-June/079963.html below:

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

[Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC) [Python-Dev] Alternative to more ABCs [was:] Iterable String Redux (aka String ABC)Paul Moore p.f.moore at gmail.com
Sun Jun 1 15:57:55 CEST 2008
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
        else:
            deal with the element as atomic

This implies that other "empty" abstract types aren't useful, though,
as they are not subclasses of anything else...

Paul.
More information about the Python-Dev mailing list

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