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

> This is delusional. It's quite unnecessary here and makes the code
> messier; that was the point of my previous mail, where I sketched out one
> alternative approach.

You are using different units to measure "mess". Linus Torvalds, AFAIR,
uses line length, function length, and indentation levels. Those say that
your example is far messier.

The point is that the more succinctly you can express your ideas in code,
the less work it is to understand it (unless you're obfuscating, but we're
not talking about that).

Error checking naturally splits into two parts, (a) check for it and (b)
handle it. Python's exceptions mean that there is NO code at all which
does (a) because that's the interpreter's job, therefore your code becomes
easier to understand. (b) is not affected; there's no practical difference
between Python

	try: do_something()
	except: handle_error()
	else: do_when_ok()

and C (or Perl or ...)
	
	if (!(err=do_something()))
		handle_error(err)
	else do_when_ok()

except that in Python you can use multi-line statements which do something
instead of calling a function, which sometimes (not always) increases
readability.

IMHO, and all that.
-- 
Matthais Urlichs



Reply to: