[Tutor] looking for some general advice

Michael Klier chi at chimeric.de
Mon Jun 11 10:58:40 CEST 2007


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

Hmmm, I did a group reply in mutt the last time, lets see if a direct
reply and manuall CC: works right.

> > 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

That`s a very useful hint :) (makes me ask myself why I didn`t thought
about that yet ;)).

> 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.

Well, that`s an option I didn`t thought of yet, I think I`ll do it that
way then.

Thanks or all your feedback.

Best Regards
Michael

-- 
Michael Klier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.python.org/pipermail/tutor/attachments/20070611/549809d0/attachment.pgp 


More information about the Tutor mailing list