Class Description

M.-A. Lemburg mal at lemburg.com
Wed Aug 18 12:25:41 CEST 1999


Glen Malley wrote:
> 
> Obviously I'm a newbie at this stuff, so go easy on me.
> I'm just curious, having not read a great deal of the
> object-oriented gear in Python...
> Can a class print out info about itself?

No, Python doesn't have class methods. You can do the same
thing via special functions accessing the internal of classes
though. See hack.py on my Python Pages for some examples.

> For example, I know classes can be dynamically added to...
> ...could a class re-write itself, if properly messed with?

Yep. No problem at all. Some of this was just recently
introduced in 1.5.1 or 1.5.2 -- can't remember, e.g. you
can assign to __bases__, __dict__, etc. special class
attributes allowing you to change the behaviour *after*
creation.

See the docs for more infos, but beware: this is not really
newbie stuff, you're up to :-)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   135 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





More information about the Python-list mailing list