[Tutor] Who uses input()? [was Re: question on "input"]

Nathan Pinno falcon3166 at hotmail.com
Mon Jul 18 15:36:35 CEST 2005


  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.

  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 
  >> 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 
  > it's getting much easier to write programs that we think might be just 
  > 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 
  > 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 
  > 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. 
  > why we bug about it every so often.
  > Hope this helps!

More information about the Tutor mailing list