Python scoping

Martin Christensen knightsofspamalot-factotum at mail1.stofanet.dk
Wed Oct 25 17:17:56 EDT 2000


>>>>> "SuppamanX" == SuppamanX  <suppamanx at collector.org> writes:
SuppamanX>    I have been using Python off and on for 6 months now and
SuppamanX> have grown to love it from the beginning. However, there is
SuppamanX> a facett of Python that annoys me somewhat. It is the
SuppamanX> 'scoping by indentation'. Coming from a background of
SuppamanX> 'formal' languages (e.g. Pascal, C, Java,...), I am
SuppamanX> accustomed to explicitly start and end my scopes with a
SuppamanX> braces. From a readability standpoint, it gets quite
SuppamanX> problematic for especially for some of the example code
SuppamanX> that I am trying to learn from.

First let me say that I am also fairly new to Python, and I have this
'odd' feeling that for some reason my code isn't nice and clean enough
if I don't use braces as delimiters. However, whether I use braces or
not, the indentation is exactly the same, so whether they're there or
not doesn't matter the least bit. They're superfluous. They're out of
your code; now get them out of your mind! :-)

Martin

-- 
GPG public key: http://home1.stofanet.dk/factotum/gpgkey.txt



More information about the Python-list mailing list