Noob question: Is all this typecasting normal?

sprad jsprad at
Fri Jan 2 22:15:04 CET 2009

I've done a good bit of Perl, but I'm new to Python.

I find myself doing a lot of typecasting (or whatever this thing I'm
about to show you is called), and I'm wondering if it's normal, or if
I'm missing an important idiom.

For example:

bet = raw_input("Enter your bet")
if int(bet) == 0:
    # respond to a zero bet

Or later, I'll have an integer, and I end up doing something like

print "You still have $" + str(money) + " remaining"

All the time, I'm going int(this) and str(that). Am I supposed to?

More information about the Python-list mailing list