[PYTHON MATRIX-SIG] Naming Conventions And Practical Experience

Fredrik Lundh fredrik_lundh@ivab.se
Thu, 8 Feb 1996 23:15:43 +0100


Konrad wrote:
> A "everything in methods" strategy won't work, because a module
> can't define methods for objects implemented in another module.

Try this:

class foo:
    def spam(self):
	print "spam"

bar = foo()

def egg(self):
    print "egg"

foo.egg = egg

bar.spam()
bar.egg()

Yes, it's weird :-)

	/F

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================