Steven D'Aprano wrote: > On Fri, 30 Mar 2007 02:04:45 -0700, DE wrote: > >> 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 don't understand why you are indenting > the function calls. What does the > indentation and spacing signify?
pushMatrix() pushes a transformation matrix onto the stack of transformation matrices. The drawing functions draw inside this context of transformations. popMatrix() pops the last transformation matrix. For example, one could push a rotation matrix that rotates the coordinate system 90 degrees from horizontal. drawStuff() might draw some text; usually this would be horizontal, but in the context of the transformation, it will ultimately be drawn vertically. As others have mentioned, this is a perfectly good application of Python 2.5's "with" statement and its context managers. The indentation is meaningful and useful. > Some people > have a strange > idea of > "increase > readability". Please contain the snark. You didn't understand why someone might want this, and that's fine. But please wait until you get a response before assuming that there could be no good reason for wanting this. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list