dynamically extend classes
Moshe Zadka
moshez at math.huji.ac.il
Sat Feb 19 14:28:40 EST 2000
More information about the Python-list mailing list
Sat Feb 19 14:28:40 EST 2000
- Previous message (by thread): dynamically extend classes
- Next message (by thread): dynamically extend classes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 19 Feb 2000, Matt Wette wrote: > > Is there a way to dynamically extend classes in Python? > > I'd like to be able to have sitecustomize.py import a module > and add methods to a class so that later, when anohter modules > imports this module and uses the class it sees the added methods. sure: >>> class foo: ... pass ... >>> def tt(self): print "hello world" ... >>> a = foo() >>> >>> foo.tt = tt >>> a.tt() hello world Don't do it. -- Moshe Zadka <mzadka at geocities.com>. INTERNET: Learn what you know. Share what you don't.
- Previous message (by thread): dynamically extend classes
- Next message (by thread): dynamically extend classes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list