Re: is there any overheard with try/except statements?

2006-03-10 Thread John Salerno
Magnus Lycka wrote: > John Salerno wrote: >> Thanks guys! I had a feeling exceptions were nothing like in C >> languages (i.e. a pain to deal with). :) > > Since when does C have exceptions? (You're not confusing C with C++ > or C#?) I meant C-based languages, like C#. -- http://mail.python.or

Re: is there any overheard with try/except statements?

2006-03-10 Thread Magnus Lycka
John Salerno wrote: > One of the things I learned with C# is that it's always better to handle > any errors that might occur within the codes itself (i.e. using if > statements, etc. to catch potential out of range indexing) rather than > use too many try/catch statements, because there is some

Re: is there any overheard with try/except statements?

2006-03-10 Thread Magnus Lycka
John Salerno wrote: > Thanks guys! I had a feeling exceptions were nothing like in C languages > (i.e. a pain to deal with). :) Since when does C have exceptions? (You're not confusing C with C++ or C#?) -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any overheard with try/except statements?

2006-03-09 Thread John Salerno
Alex Martelli wrote: > In general, it's more frequent for EAFP to be handier and more solid, > and performance may well not matter -- but if you find yourself trying > to squeeze every last drop of performance from a region of your code > that profiling has shown to be a bottleneck, module timeit

Re: is there any overheard with try/except statements?

2006-03-08 Thread Steve Holden
Delaney, Timothy (Tim) wrote: [...] > > Generally, you should always go for whatever is clearest/most easily > read (not just in Python, but in all languages). +1 QOTW regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd www.holdenweb.com Lo

Re: is there any overheard with try/except statements?

2006-03-08 Thread Alex Martelli
John Salerno <[EMAIL PROTECTED]> wrote: > John Salerno wrote: > > One of the things I learned with C# is that it's always better to handle > > any errors that might occur within the codes itself (i.e. using if > > statements, etc. to catch potential out of range indexing) rather than > > use too

Re: is there any overheard with try/except statements?

2006-03-08 Thread John Salerno
John Salerno wrote: > One of the things I learned with C# is that it's always better to handle > any errors that might occur within the codes itself (i.e. using if > statements, etc. to catch potential out of range indexing) rather than > use too many try/catch statements, because there is some

RE: is there any overheard with try/except statements?

2006-03-08 Thread Delaney, Timothy (Tim)
Steven D'Aprano wrote: > The classic example of the "look before you leap" and > "just do it" idioms involves looking up a key in a > dictionary: > > # method one > if some_dict.has_key(key): > do_something_with(some_dict[key]) > else: > do_something_else() FWIW, in recent Python versi

Re: is there any overheard with try/except statements?

2006-03-08 Thread Steven D'Aprano
John Salerno wrote: > One of the things I learned with C# is that it's always better to handle > any errors that might occur within the codes itself (i.e. using if > statements, etc. to catch potential out of range indexing) rather than > use too many try/catch statements, because there is some

Re: is there any overheard with try/except statements?

2006-03-08 Thread Roy Smith
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > One of the things I learned with C# is that it's always better to handle > any errors that might occur within the codes itself (i.e. using if > statements, etc. to catch potential out of range indexing) rather than > use

Re: is there any overheard with try/except statements?

2006-03-08 Thread Paul McNett
John Salerno wrote: > One of the things I learned with C# is that it's always better to handle > any errors that might occur within the codes itself (i.e. using if > statements, etc. to catch potential out of range indexing) rather than > use too many try/catch statements, because there is some

is there any overheard with try/except statements?

2006-03-08 Thread John Salerno
One of the things I learned with C# is that it's always better to handle any errors that might occur within the codes itself (i.e. using if statements, etc. to catch potential out of range indexing) rather than use too many try/catch statements, because there is some overhead every time the pro