Thursday, June 16, 2011

Complete Idiot's Guide To Jython for Noob Dummies

It's been a long time since I have jython'ed.  Here's a tip...

you can't concatenate an integer and a string.  Make sense, but it's a pain for someone that's used to doing a lot of perl/shell type scripting.

if you try something like this:

print "counter is " +cntr
you're going to get an error similar to:
TypeError: __add__ nor __radd__ defined for these operands

So how do you do this?  It's almost too easy:
print "counter is " +cntr.toString()

No comments: