[DB-SIG] postgresql-python return type

Tom Bryan tbryan@starship.beopen.com
Wed, 28 Jun 2000 19:14:14 -0700 (PDT)


On Mon, 19 Jun 2000, Karl Thomas Diedrich wrote:

> type(tagetSearchResult) = <pgqueryobject at ...>
> I can display the value(query results) of the object with the print
> command
> print targetSearchResult
> 
> I tried formatting it as a string but I get the object type name instead
> of the value
> format = '%s'
> results = format % (targetSearchResult)
> print reults   =    <pgqueryobject at ...>

That's very odd.   I'm pretty sure that both print and formatting as %s
both call the __str__ method of the class.  In that case, the following
pieces of code should print the same output for all objects var

print var

and 

x = '%s' % var; print x

At least now you have a general Python question that you can post to
comp.lang.python.  Perhaps my claim is incorrect.

----Tom