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/2001-September/017528.html below:

[Python-Dev] why doesn't print pass unicode strings on to the file object?

[Python-Dev] why doesn't print pass unicode strings on to the file object?Guido van Rossum guido@python.org
Tue, 18 Sep 2001 09:24:20 -0400
> _fields = {'encode':0,'decode':1,'reader':2,'writer':3}
> class CodecInfo(tuple):
>     __dynamic__ = 0
>     def __getattr__(self, name):
>         try:
>             return self[_fields[name]]
>         except KeyError:
>             raise AttributeError, name

You want to change that raise statement into

              return tuple.__getattr__(self, name)

Remember, new-style __getattr__ *replaces* the built-in getattr
operation; it doesn't only get invoked when the built-in getattr
doesn't find the attribute, like it does for classic classes.

(I'm still considering whether this is too backwards incompatible; we
could have two getattr hooks, one old-style and one new-style.)

--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