Op 26/02/2023 om 6:53 schreef Hen Hanna:
> There are some similarities between Python and Lisp-family > languages, but really Python is its own thing.

    Scope (and extent ?) of   variables is one reminder that  Python is not Lisp

     for    i     in      range(5):      print( i )
                      .........
     print( i )

ideally, after the FOR loop is done,  the (local) var  i should also disappear.
(this almost caused a bug for me)
I wouldn't say "i *should* also disappear". There is no big book of programming language design with rules like that that all languages have to follow. Different languages have different behavior. In some languages, for/if/while statements introduce a new scope, in other languages they don't. In Python, they don't. I won't say one is better than the other; they're just different.

--
"Most of us, when all is said and done, like what we like and make up
reasons for it afterwards."
        -- Soren F. Petersen

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to