Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev
Re: [Python-3000] Iterable String Redux (aka String ABC)
 

Index | Next | Previous | View Flat


jimjjewett at gmail

May 27, 2008, 3:40 PM


Views: 131
Permalink
Re: [Python-3000] Iterable String Redux (aka String ABC)

On 5/27/08, Benji York wrote:
> Guido van Rossum wrote:
> > Armin Ronacher wrote:

> >> Basically *the* problematic situation with iterable strings is something like
> >> a `flatten` function that flattens out every iterable object except of strings.

> > I'm not against this, but so far I've not been able to come up with a
> > good set of methods to endow the String ABC with. Another problem is
> > that not everybody draws the line in the same place -- how should
> > instances of bytes, bytearray, array.array, memoryview (buffer in 2.6)
> > be treated?

> Maybe the opposite approach would be more fruitful. Flattening is about
> removing nested "containers", so perhaps there should be an ABC that
> things like lists and tuples provide, but strings don't. No idea what
> that might be.

It isn't really stringiness that matters, it is that you have to
terminate even though you still have an iterable container.

The test is roughly (1==len(v) and v[0]==v), except that you want to
stop a layer sooner.

Guido had at least a start in Searchable, back when ABC were still in
the sandbox:
http://svn.python.org/view/sandbox/trunk/abc/abc.py?rev=55321&view=auto

Searchable represented the fact that (x in c) =/=> (x in iter(c))
because of sequence searches like ("Error" in results)

-jJ
_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Subject User Time
Re: [Python-3000] Iterable String Redux (aka String ABC) jimjjewett at gmail May 27, 2008, 3:40 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.