[Tutor] looking for some general advice

Alan Gauld alan.gauld at btinternet.com
Mon Jun 11 01:43:23 CEST 2007

"Michael Klier" <chi at chimeric.de> wrote 

I'm not surecwhy but your messages are coming through to me 
as text attachments which makes quoting them tricky...

> Also, what would be the right exception to raise if not 
> enough arguments were passed to a programm?

I don't think there is a right answer, you can decide 
for yourself, buty in general I try using the >>> prompt 
with a deliberate error to see what Python does, thus:

>>> range()
Traceback (most recent call last):
  File "<input>", line 1, in ?
TypeError: range expected at least 1 arguments, got 0

So it looks like TypeError but personally I'm not so sure 
that works for argv... I think a simple usage message and 
exit with non zero is fine.

Alan G.

More information about the Tutor mailing list