Use of a variable in parent loop

Cameron Simpson cs at cskk.id.au
Sun Sep 27 17:24:07 EDT 2020


On 27Sep2020 15:18, Stephane Tougard <stephane at sdf.org> wrote:
>In many non declarative language, if I do print($var), it just prints
>and undefined value with returning an error.

And that way lie MANY MANY bugs not detected until an undefined value 
actually causes an issue, if that ever happens. In some languages 
undefined values are quietly promotes to eg 0 in a numeric context. No 
errors, no exceptions, just silent incorrect results.

In Python the choice was made to raise an error for use of a variable 
not previously bound.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list