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/2002-November/030133.html below:

[Python-Dev] Printing and __unicode__

[Python-Dev] Printing and __unicode__Guido van Rossum guido@python.org
Wed, 13 Nov 2002 16:17:30 -0500
> > I'm not sure about those names, but I agree that the encoding should
> > be forced when the StringIO instance is created.  Given that using
> > Unicode with these is currently fragile at best, maybe we should say
> > that unless you give an encoding argument, it's a byte stream and
> > doesn't allow Unicode at all?  That would be consistent with cStringIO.
> 
> But it would break compatibility, atleast with
> xml.dom.minidom.Node.write, which support StringIO currently, and will
> collect Unicode strings in it.

Would it be acceptable if StringIO required you to be consistent,
i.e. write only Unicode *or* only 8-bit strings, and never mix them?

That would be some kind of magical behavior; the encoding attribute
should be set to reflect the mode after the first write, and should be
None initially (or some other way to indicate the magic).

--Guido van Rossum (home page: http://www.python.org/~guido/)



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