On Tue, May 27, 2008 at 12:42:48PM -0700, Guido van Rossum wrote:
> [+python-3000]
> 
> On Tue, May 27, 2008 at 12:32 PM, Armin Ronacher
> <[EMAIL PROTECTED]> wrote:
...
> > A problem comes up as soon as user defined strings (such as UserString) is
> > passed to the function.  In my opinion a good solution would be a "String"
> > ABC one could test against.
> 
> 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?
> 
> -- 
> --Guido van Rossum (home page: http://www.python.org/~guido/)

The issue goes beyond iterability. If a user defined string such as
UserString that is not derived from one of the "true" builtin string
types is passed to a builtin function that expects a string it will be
rejected. PyArgs_ParseTuple discriminates against such user defined
types :-)

If a String ABC is implemented it could be used as a signal that the
object is not just convertable to a string (virtually all objects are)
but IS a string and its __str__ should be used during builtin function
argument parsing.

-
Oren

_______________________________________________
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