[Tutor] First program

Ray Parrish crp at cmc.net
Sat Mar 13 19:07:49 CET 2010

Andre Engels wrote:
> On Sat, Mar 13, 2010 at 3:11 AM, Ray Parrish <crp at cmc.net> wrote:
>> Andre Engels wrote:
>>> On 3/12/10, yd <ydmt923 at gmail.com> wrote:
>>>>  else:
>>>>    raise Exception('{0}, is not a valid choice'.format(choice))
>>> This will cause the program to stop-with-error if something wrong is
>>> entered. I think that's quite rude. I would change this to:
>>>  else:
>>>    print('{0}, is not a valid choice'.format(choice))
>> Here's what I get from that, could you please explain why?
> You're probably using Python 2.4 or 2.5; the .format method has been
> introduced in Python 2.6, and is considered the 'standard' way of
> working in Python 3. For older Python versions, this should read
> print('%s, is not a valid choice'%(choice))
Yes, I'm using 2.45.2 as that is the highest version available in the 
Ubuntu repositories, and I'd like to keep it simple for users of 
programs i write. If I install a higher version from somewhere other 
than the repositories it will force users of my programs to do the same, 
and the repositories are the trusted source of software for Ubuntu, and 
other Linux users.

Thanks for being so observant.

Later, Ray Parrish

Linux dpkg Software Report script set..
Ray's Links, a variety of links to usefull things, and articles by Ray.
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.

More information about the Tutor mailing list