Re: Overuse of try/except/else?

2011-05-21 Thread James Mills
On Sat, May 21, 2011 at 3:40 PM, Cameron Simpson c...@zip.com.au wrote: These days I think I'd use a LateFunction (a facility of my own which is a lot like the futures module) which returns a callable when you submit a function; the worker thread runs the submitted function and catches the

Re: Overuse of try/except/else?

2011-05-21 Thread Daniel Kluev
On Tue, May 10, 2011 at 11:40 AM, Kyle T. Jones onexpadrem...@evomeryahoodotyouknow.com wrote: It has been hard for me to determine what would constitute overuse. Good example of abuse is catching KeyboardInterrupt or SystemExit inside some library code. PycURL does it, and its truly annoying.

Re: Overuse of try/except/else?

2011-05-20 Thread Cameron Simpson
On 11May2011 13:37, James Mills prolo...@shortcircuit.net.au wrote: | On Tue, May 10, 2011 at 7:34 PM, Jean-Michel Pichavant | jeanmic...@sequans.com wrote: | You can reraise the exception without loosing the stack trace. | | try: | ... | except SomeException, exc: | log(exc) | print 'Hello

Re: Overuse of try/except/else?

2011-05-10 Thread Jean-Michel Pichavant
James Mills wrote: On Tue, May 10, 2011 at 10:40 AM, Kyle T. Jones onexpadrem...@evomeryahoodotyouknow.com wrote: It has been hard for me to determine what would constitute overuse. A rule of thumb I always follow and practice is: Let the error lie where it occurred. or Don't hide

Re: Overuse of try/except/else?

2011-05-10 Thread Adam Tauno Williams
On Mon, 2011-05-09 at 19:40 -0500, Kyle T. Jones wrote: It has been hard for me to determine what would constitute overuse. The chronic problem is under use; so I wouldn't worry much about it. try/except should occur as often as is required for the application to either deal gracefully with the

Re: Overuse of try/except/else?

2011-05-10 Thread Hans Georg Schaathun
On Tue, 10 May 2011 07:36:42 -0400, Adam Tauno Williams awill...@whitemice.org wrote: : On Mon, 2011-05-09 at 19:40 -0500, Kyle T. Jones wrote: : It has been hard for me to determine what would constitute overuse. : : The chronic problem is under use; so I wouldn't worry much about it. : :

Re: Overuse of try/except/else?

2011-05-10 Thread Paul Probert
On 05/09/2011 07:40 PM, Kyle T. Jones wrote: It has been hard for me to determine what would constitute overuse. Cheers. Well, for me the power of exceptions is that it lets me write much more concise code. For example, suppose I call a routine I wrote over and over, and I have to check for

Re: Overuse of try/except/else?

2011-05-10 Thread James Mills
On Tue, May 10, 2011 at 7:34 PM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: You can reraise the exception without loosing the stack trace. try: ... except SomeException, exc: log(exc) print 'Hello world' raise # raise exc would loose the original stack trace Valid point :)

Overuse of try/except/else?

2011-05-09 Thread Kyle T. Jones
It has been hard for me to determine what would constitute overuse. Cheers. -- http://mail.python.org/mailman/listinfo/python-list

Re: Overuse of try/except/else?

2011-05-09 Thread James Mills
On Tue, May 10, 2011 at 10:40 AM, Kyle T. Jones onexpadrem...@evomeryahoodotyouknow.com wrote: It has been hard for me to determine what would constitute overuse. A rule of thumb I always follow and practice is: Let the error lie where it occurred. or Don't hide errors.. It's good practice