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-December/018838.html below:

[Python-Dev] __getattribute__ should require a string?

[Python-Dev] __getattribute__ should require a string? [Python-Dev] __getattribute__ should require a string?Guido van Rossum guido@python.org
Tue, 04 Dec 2001 10:32:27 -0500
> > Is there any reason why people should be allowed to assign and
> >  retrieve attributes with non-string names?
> 
> Not really, but why should we actively try to prevent it when it's
> easy to do self.__dict__[1] = 'a'?  This means you can't rely on all
> attribute names being strings, and I'm not going to prevent *that*.
> 
> The proper fix IMO for the bug you found is to be more careful when
> formatting the error message.

I take it back.  All the other functions in object.c require the
getattr/setattr argument to be a string or Unicode object.  I'll fix
object.__getattribute__ and object.__setattr__ (which are really
PyObject_Generic{Get,Set}Attr) to do the same.

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