A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-November/030117.html below:

[Python-Dev] Printing and __unicode__

[Python-Dev] Printing and __unicode__ [Python-Dev] Printing and __unicode__Martin v. Loewis martin@v.loewis.de
13 Nov 2002 19:29:17 +0100
"M.-A. Lemburg" <mal@lemburg.com> writes:

> > In case the stream is "natively" Unicode (i.e. doesn't ever convert to
> > byte strings), setting encoding to None should be allowed (this
> > actually indicates that StringIO should have the encoding attribute).
> 
> -1
> 
> The presence of .encoding should indicate that it is
> safe to write Unicode objects to .write(). Let the stream
> decide what to do with the Unicode object (e.g. it would
> probably encode the Unicode object using the .encoding
> and only then write it to the outside world).

So should StringIO object have an .encoding attribute or not?

If not, should

f = StringIO.StringIO()
print >>f,x

try to invoke Unicode conversion or not? If it should, how should it
find out that this is safe to do?

Regards,
Martin



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