[Python-ideas] stealing "var" from javascript

Jim Jewett jimjjewett at gmail.com
Mon Apr 14 02:04:32 CEST 2008


On 4/11/08, Neil Toronto <ntoronto at cs.byu.edu> wrote:

>  In general, the more compressed your code is, the harder it is to detect
>  encoding errors. In this case, Python's designers decided on compression
>  over easy error detection.

My experience is more the opposite.  Yes, I have seen bugs from
too-short identifiers, or wrongly assumed defaults.

But I have seen far more errors from simple mistakes that would have
been avoided if two parts of the code were visible at the same time.
And I have seen plenty of bugs from things that people skipped over
reading because they were skimming past boilerplate.  And, of course,
there are tons of (admittedly shallow) bugs that wouldn't be bugs in
the first place if you didn't have to specify everything.  (e.g.,
things fixed by explicit casts.)

"var" by itself won't shove much off the screen.  But changing from:

"""
def fn(a=4):
    x=5
    ...
"""
to:
"""
def fn(a=4):

    var x
    var y
    var z

    x=5
    ...
"""

is a big step in that direction.

-jJ



More information about the Python-ideas mailing list