> On Mon, Feb 05, 2001 at 01:37:39PM -0500, Guido van Rossum wrote: > > Now, can you do things like this: > [example cut] > > No, it would have to be written like this: > > >>> from types import * > >>> class MyInt(IntType): # add a method > def add1(self): return self.value+1 > > >>> i = MyInt(10) > >>> i.add1() > 11 > >>> > > Note the value attribute. The IntType.__init__ method is > basicly: > > def __init__(self, value): > self.value = value So, "class MyInt(IntType)" acts as a sort-of automagical "UserInt" class creation? (Analogous to UserList etc.) I'm not sure I like that. Why do we have to have this? --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