Debugging (was Re: Why not allow empty code blocks?)

Paul Rubin no.email at nospam.invalid
Tue Aug 2 17:54:45 EDT 2016


Terry Reedy <tjreedy at udel.edu> writes:
> I think it is you who is unwilling to admit that nearly everything
> that would be useful also has a cost, and that the ultimate cost of
> adding every useful feature, especially syntax features, would be to
> make python less unusable.

I think you meant "usable" ;).  Some of this results from Python's
statement-vs-expression distinction.  I'm not going to claim that's a
broken feature of Python, since it has its supporters; but languages
that don't make the distinction have more flexibility in implementing
such features as ordinary functions rather than syntax features.

    Ruby:  17.times| code |
    Haskell: replicateM_ 17 code
    Lisp: (dotimes (i 17) code...)
    etc.

The Lisp example binds 'i' to the loop index, but that's just a choice
made in how the dotimes macro was implemented.  The scope of i is
limited to the dotimes construct, unlike in Python.



More information about the Python-list mailing list