Object type problem

Jonathan Donald jonathan at ldis.com
Thu May 11 22:28:26 CEST 2000


Sorry if this is a really dumb question:

I get an odd (to me) error message when trying to do this:

        logstr = now + ": " + strng + "\n"

the error message:

      TypeError: __add__ nor __radd__ defined for these operands 

The facts:

now is a string
strng is _usually_ a string (or None/null, depending on the
circumstances). Maybe something else...?

The error never takes place when strng is a string of one or more
characters.

I understand that __add__ and __radd__ are special operator definitions,
and I'm assuming that when this error comes up, strng is not a string,
but another type of object that does not define these operators.

I've tried testing for strng==None, but this doesn't stop the error from
being reported.

I've tried to figure out what class strng belongs to, but I can't seem
to do it.

Can anyone help me?

Many thanks,

Jonathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jonathan.vcf
Type: text/x-vcard
Size: 291 bytes
Desc: Card for Jonathan Donald
URL: <http://mail.python.org/pipermail/python-list/attachments/20000511/bcf584cf/attachment.vcf>


More information about the Python-list mailing list