Noob question: Is all this typecasting normal?

2009-01-02 Thread sprad
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
this:

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

All the time, I'm going int(this) and str(that). Am I supposed to?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread sprad
On Jan 3, 6:41 pm, Steven D'Aprano  wrote:
> The OP comes from a Perl background, which AFAIK allows you to concat
> numbers to strings and add strings to numbers. That's probably the (mis)
> feature he was hoping Python had.

That's correct -- and that's been one of the more difficult parts of
my transition. Learned C++ in college, spent a few years doing Perl,
and now all of a sudden type matters again. It's a very different
philosophy, but I'm determined to stick with it until I have an Aha!
moment and find something I can do more easily than I can with Perl.
--
http://mail.python.org/mailman/listinfo/python-list


Python in High School

2008-04-01 Thread sprad
I'm a high school computer teacher, and I'm starting a series of
programming courses next year (disguised as "game development" classes
to capture more interest). The first year will be a gentle
introduction to programming, leading to two more years of advanced
topics.

I was initially thinking about doing the first year in Flash/
ActionScript, and the later years in Java. My reasoning is that Flash
has the advantage of giving a quick payoff to keep the students
interested while I sneak in some OOP concepts through ActionScript.
Once they've gotten a decent grounding there, they move on to Java for
some more heavy-duty programming.

I've never used Python, but I keep hearing enough good stuff about it
to make me curious.

So -- would Python be a good fit for these classes? Could it equal
Java as the later heavy-duty language? Does it have enough quickly-
accessible sparklies to unseat Flash?

I want to believe. Evangelize away.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python in High School

2008-04-01 Thread sprad
On Apr 1, 11:41 am, mdomans <[EMAIL PROTECTED]> wrote:
> Python needs no evangelizing but I can tell you that it is a powerfull
> tool. I prefer to think that flash is rather visualization tool than
> programing language, and java needs a lot of typing and a lot of
> reading. On the other hand python is simple to read and write, can be
> debuged easily, is intuitive and saves a lot of time. It also supports
> batteries included policy and you can't get more OO than python.

One advantage of Flash is that we can have something moving on the
screen from day one, and add code to it piece by piece for things like
keyboard or mouse control, more and more complex physics, etc. Is
there an equivalent project in Python?
-- 
http://mail.python.org/mailman/listinfo/python-list