Indentation for code readability

Thomas Krüger newsgroups at
Fri Mar 30 11:20:38 CEST 2007

DE schrieb:
> Hello,
> Here is what I do in C++ and can not right now in python :
> pushMatrix()
> {
>      drawStuff();
>      pushMatrix();
>      {
>             drawSomeOtherStuff()
>      }
>      popMatrix();
> }
> popMatrix();
> The curly brackets have no functional meaning but increase the
> readability significantly. I want to be able to do the same thing in
> python. Since curly brackets are not available and indenting without
> an if or while conditional doesn't work, I have started to question if
> this is possible in python at all.
> Any ideas ?

I've been thinking about that for some minutes now and I have doubts
that it will increase the readability. Maybe for you as you invented
that style but not for others.
There are a few standards for formatting C code and even this few have
cause many discussions between developers.
Python has one convention (defined in PEP 8) and the deeper you dive
into the language the more you will like it.
BTW: having one way to do it is one of the main ideas of Python's


More information about the Python-list mailing list