Why Use str on a doc string? : str « Buildin Function « Python






Why Use str on a doc string?

Why Use str on a doc string?


def foo(): print 2 

foo() 

print foo.__doc__  
foo.__doc__ == None

print str(foo.__doc__)


# The str function takes the null value and returns a string representation of it, 

#can use either == None or is None, but is None is faster.

           
       








Related examples in the same category

1.str Functionstr Function
2.Used by print: user-friendly formUsed by print: user-friendly form
3.Input and Output: str() function: return representations of values which are human-readableInput and Output: str() function: return representations of values which are human-readable