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-August/017232.html below:

copy, len and the like as 'object' methods?

[Python-Dev] Re: copy, len and the like as 'object' methods? [Python-Dev] Re: copy, len and the like as 'object' methods?Guido van Rossum guido@python.org
Thu, 23 Aug 2001 09:24:52 -0400
> A strange thought, but with the advent of type/class unification and the
> 'object' base class, is it possible to inject new methods into the 'object'
> type at runtime, allowing:
> 
>     def len(self):
>         return self.__length__()
>     object.len = len

No you can't.  Built-in types are immutable.  Two reasons: they're
shared between multiple interpreters, and it would encourage modules
to modify a built-in type to suit their own needs, which it might
break other modules.

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