[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Python or Perl for a Debian maintainance project?



Hi, Andrew Suffield wrote:

>> The whole _point_ of this (part of the) discussion is that in Python,
>> code that doesn't explicitly test for errors is perfectly OK because the
>> interpreter does it for you.
> 
> I would say that the whole point was that is *not* okay.

So what's your problem with implicit throw-exception-if-error?

Compare -- local error handling:

	if(!some_code()) {
		handle_error(); }
vs.
	try: some_code()
	except: handle_error()

Looks more-or-less the same (in the sense that both languages force you
to actually type something), thus no problem.

Non-local errors are easier to do in Python:

	if(!some_code()) {
		throw_error(); }
vs.
	some_code()


On the other hand, explicitly ignoring errors is easier in C/Perl:

	some_code();
vs.
	try: some_code()
	except: pass

To _implicitly_ ignore errors is impossible in Python. IMHO that's a
Good Thing.

The only other difference is that Python makes it easier to inadvertently
throw an exception for something that should have been perfectly OK, while
in Perl/C it's very easy to inadvertently ignore an error you should have
handled.

The first kind of bug is _far_ easier to fix, IMHO.

-- 
Matthias Urlichs



Reply to: