Beginner question: Python types

Uppal, Deepali deepali at ti.com
Wed Jun 1 00:43:35 EDT 2005


 

Hello,

 

            I am facing a bit of a problem due to python implicitly
attaching

a type to an object. I will briefly tell you the problem that

I am facing. I am trying to print the docstring of a test case in 

my pyUnit base test class. I accept the name of the test class as

a command line option. So instead of printing the docstring of

the test case, it prints the docString of a string object.

 

I would like to give an example here

 

import test_script


gettatr( test_script.test_class.test_case, '__doc__')          

 

With this simple code, I am able to print the docstring

of the test case.

 

However, since I accept the test case information as a command line

option. So instead of printing the docstring of the test case it

prints the docstring of a string object.

=>  'str(object) -> string\n\nReturn a nice string representation of the
object.\nIf

 the argument is a string, the return value is the same object.'

 

Is there someway, I can tell the script to change the type of

the object from string to an instancetype of a test case?

 

I am quite a newbie in python so I would appreciate any help on this.

 

Regards,

Deepali

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050601/94cf7085/attachment.html>


More information about the Python-list mailing list