Reflection in Python?

anders777 at my-deja.com anders777 at my-deja.com
Wed Jun 30 18:30:04 CEST 1999


From: anders777 at my-deja.com

I've just started programming in Python, and I
could really use some help figuring out something.
 I'd like to implement Kent Beck's unit tester in
Python (someone posted a very nice alternative a
few weeks ago, but Junit's approach works better
for my project's needs).  How do I do the
equivalent of what Java calls reflection? I want
to do the following:

test = MathTest("testAdd")

where test.run() will run the "testAdd" method on
the MathTest object?  I also want to be able to
tell the user the name of the object (MathTest)
and the method in case the method fails.  Any
thoughts?

Thanks,
Anders Schneiderman
National Journal Daily Briefings Group




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list