On Wed, May 28, 2008 at 5:48 AM, Carl Johnson <[EMAIL PROTECTED]> wrote:
> Proposed behavior of the __str__ method for iterables is that it returns the
> result of "".join(str(i) for i in self).

In 8-9 years of python programming I have probably never needed to do
"".join(str(i) for i in self), so even if there was a __str__ on
iterables, this seems to me to be a particularily useless default. :)

> In order to replicate the behavior of filter with a comprehension

Instead of running filter on a string, you can replace the offending
character with emptyness.

filter(lambda c: c!="a", "abracadbra")
'brcdbr'

"abracadbra".replace('c', '')
'brcdbr'

I find using filter on a string kinda strange, I have to say. How
often do you have to filter away certain characters in s a string?
Never happened to me.

-- 
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to