2 questions about scope

Gabriel Zachmann zach at cs.uni-bonn.de
Mon Oct 25 17:04:30 CEST 2004


I am relatively new to python, but i know some other languages, such as C++,
fairly well.
After reading up a little bit in the reference manual, section 4.1,
and searching this NG, i still have 2 questions about python's scoping
rules.

1. Exactly what are the major differences between python's and C++ scoping
   rules?

2. Why is it that 'while', 'for', etc., don't introduce a new block?
   (so that variables bound inside those blocks would be local to those
   blocks only?)

I will be most grateful for all insights or pointers to literature.

Best regards,
Gabriel.

-- 
/-------------------------------------------------------------------------\
| We act as though comfort and luxury                                     |
| were the chief requirements of life,                                    |
| when all that we need to make us happy                                  |
| is something to be enthusiastic about.              (Einstein)          |
+-------------------------------------------------------------------------+
| zach at cs.uni-bonn.de            __@/'        www.gabrielzachmann.org     |
\-------------------------------------------------------------------------/



More information about the Python-list mailing list