Robert Johnson wrote: > Actually I was referring to the instance of the class (I use the term > "Object" as meaning the instance of the class). Most books I have read use > the term "Object" in this manner. well, you used the phrase "Class Object", and talked about adding stuff to the class. Python, like many other OO languages, have special class objects that represent the class (C++ is an exception). in the following snippet, the "class Spam" statement creates a class object, and binds it to the name "Spam": >>> class Spam: ... pass ... >>> Spam <class __main__.Spam at 00889784> >>> type(Spam) <type 'class'> > I am coming from the C++ world where if one wanted to extend a class, one > would override the base class (or insert into the original class if you had > the source) and add any additional variables to the new class. It just > seemed odd to me that one could just add things on the fly, but that is just > my bias. the fact that you can do something doesn't mean that it's good style, of course. like all introspective stuff, class object hacking should be used sparingly, and only when there's no better way to do it. Cheers /F
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