[Tutor] How do I go about this? [was Re: Who uses input()? [was Re: question on "input"]]

Nathan Pinno falcon3166 at hotmail.com
Thu Jul 28 01:11:23 CEST 2005


I first posted my question in this post, but no one seemed to answer me.
----- Original Message ----- 
From: "Nathan Pinno" <falcon3166 at hotmail.com>
To: "Danny Yoo" <dyoo at hkn.eecs.berkeley.edu>
Cc: <tutor at python.org>; "Terry Reedy" <tjreedy at udel.edu>
Sent: Monday, July 18, 2005 7:36 AM
Subject: Re: [Tutor] Who uses input()? [was Re: question on "input"]


>  Danny,
>
>  It sure did, though I wish there was an easier way of coding it than
> int(raw_input())! Any ideas would gladly be appreciated.
>
>  By the way, is there any code floating out there that can show how many
> possible mixtures there are, e.g. for x0, x1, x2, x3, and a0, a1, a2, and 
> a3
> for example. If there is, show me it, please. I'm getting confused writing
> my MasterMind and don't want to screw up bad, e.g. repeat the same answer 
> in
> a different way.
>
>  Thanks,
>  Nathan Pinno.
>  ----- Original Message ----- 
>  From: "Danny Yoo" <dyoo at hkn.eecs.berkeley.edu>
>  To: "Nathan Pinno" <falcon3166 at hotmail.com>
>  Cc: "Terry Reedy" <tjreedy at udel.edu>; <tutor at python.org>
>  Sent: Monday, July 18, 2005 2:14 AM
>  Subject: Re: [Tutor] Who uses input()? [was Re: question on "input"]
>
>
>  >
>  >
>  > On Mon, 18 Jul 2005, Nathan Pinno wrote:
>  >
>  >> I find it easier to remember and faster to code than int(raw_input()).
>  >> The faster I can code a program, the better in my opinion. So what if
> it
>  >> has a few bugs, I fix them gradually.
>  >
>  > Hi Nathan
>  >
>  > You're right, just as long as we're writing programs that are only 
> meant
>  > to be used by ourselves, and as long as we're sure that it's not 
> talking
>  > to the outside world.  The driving issue behind getting paranoid is
> this:
>  > it's getting much easier to write programs that we think might be just
> for
>  > ourselves, but which become useful for others.
>  >
>  > And as soon as we write programs that other people are going to use, we
>  > really do have to play by a different set of rules than just ease of
>  > programming.  Some folks were casual about eval(), and look what
> happened
>  > to them:
>  >
>  >    http://gulftech.org/?node=research&article_id=00088-07022005
>  >
>  > They should have known better.
>  >
>  > This problem is not exclusive to programmers in PHP:  programmers in
>  > Python make the same kind of mistakes.  As a concrete example, take a
> look
>  > at the comments about the deprecated "SimpleCookie" and "SerialCookie"
>  > functions:
>  >
>  >    http://www.python.org/doc/lib/module-Cookie.html
>  >
>  > Again, they should have known better.  And we should know better.
>  >
>  > So we do have a responsibility to state up front that using 'eval' (or
>  > things that call 'eval' for us) is convenient, but it's not safe.
> That's
>  > why we bug about it every so often.
>  >
>  >
>  > Hope this helps!
>  >
>  >
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


More information about the Tutor mailing list