"Steven Bethard" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I don't like this idea much because it depends on str and unicode _not_ 
> having a particular function.  I haven't seen any guarantee anywhere that 
> str or unicode won't ever grow an __iter__ method.  So this code seems 
> dangerous as far as future compatibility goes.

When CPython's support for the old iteration protocol goes away, which I 
expects it will someday, strings will have to grow an __iter__ method. 
Even now, I think this difference between strings and lists is more of an 
accident than a logical design.  So the test is opaque and specific to 
current CPython.  The validity of something like a = a+'', however, is 
inherent to the nature of strings.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to