Indent testers needed (Prothon)

Josiah Carlson jcarlson at uci.edu
Sat Apr 3 16:53:45 EST 2004


>>The above code shows how you can make Prothon code
>>extraordinarily ugly by exploting the continuation rules.
>>Certainly most people don't see such ugly continuations
>>in Python, but I think rule #3 is begging for trouble.
> 
> That's a strawman. The fact that you *could* write strange code like that
> doesn't mean that there is anything wrong with Mark's continuation rules.

I state almost as much, "most people don't see such ugly continuations 
in Python", which expresses that we don't see that kind of ugly code in 
Python.  I believe that the reason for it is because most people don't 
like to see such ugly code.  However, as I said, I think that #3 is 
begging for some schmuck to exploit it.


> I could write a long Python program that uses no functions, classes, or
> anything else to break it into smaller understandable pieces. Just one big
> long piece of code that is indented to twenty levels. While I'm at it, I'll
> use variable names that obscure what the code does.
> 
> Does that imply that there should be a maximum length to a Python source
> file, a limit on the level of indenting, and restrictions on what variable
> names I can use? Of course not.

You're going a few steps beyond what I was saying.  I stated that it 
makes sense to discourage ugly code.  The code that you are describing 
is functionally impossible to maintain (unless it was generated by 
inlining all module-level function calls, something that you, I, or 
anyone else could technically do, or even write a program to do).  I 
think that by people using Python (or in this case Prothon), by 
definition it is implied that we should be writing maintainable code.

Personally, I don't find implicitly continued lines to be more 
maintainable than explicitly continued lines, and because explicit 
continuations (with '\') do the job already, if this were Python, it 
would violate both the "flat is better than nested" and "there should be 
one-- and preferably only one --obvious way to do it" zens.

As for whether Mark wants to follow the Zen of Python, that is up to 
him.  However, considering that he's using the c.l.py newsgroup to 
discuss Prothon, using a very large portion of the syntax of Python, and 
has talked about translating a large portion of the standard library of 
Python to Prothon via some sort of automatic method, I would say that 
violating the Zen is a foolish "early optimization".

  - Josiah



More information about the Python-list mailing list