Re: Indentation for code readability

2007-03-31 Thread jkn
If I wanted to mark out stack depth stuff like this in python, I'd do it with some form of stylised comment, like this: # LEVEL 0 pushMatrix(): # LEVEL 1 drawstuff() pushMatrix() # LEVEL 2 drawSomeOtherStuff() popMatrix() # LEVEL 1 popMat

Re: Indentation for code readability

2007-03-30 Thread Steven D'Aprano
On Fri, 30 Mar 2007 18:32:02 -0500, Robert Kern wrote: >> 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 befo

Re: Indentation for code readability

2007-03-30 Thread Robert Kern
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(); >>

Re: Indentation for code readability

2007-03-30 Thread DE
> > > The curly brackets have no functional meaning... > > "Curly brackets have no functional meaning"? Surely you must be > thinking of C, but not C++. Some of the most powerful idioms (idia?) > of C++ make use of functionality that runs when a closing bracket > causes local variables to fall ou

Re: Indentation for code readability

2007-03-30 Thread Paul McGuire
On Mar 30, 4:04 am, "DE" <[EMAIL PROTECTED]> wrote: > > The curly brackets have no functional meaning... "Curly brackets have no functional meaning"? Surely you must be thinking of C, but not C++. Some of the most powerful idioms (idia?) of C++ make use of functionality that runs when a closing

Re: Indentation for code readability

2007-03-30 Thread Alex Martelli
Thomas Krüger <[EMAIL PROTECTED]> wrote: > BTW: having one way to do it is one of the main ideas of Python's > philosophy. Yes, just like C's -- see point 4 in the "Spirit of C" summary taken from the ISO Standard for C and quoted e.g. at . Of cou

Re: Indentation for code readability

2007-03-30 Thread DE
Thanks Duncan. I guess you and Peter have been typing in the same minute :) It really looks like a good solution, I wasn't aware this with statement in Python. I can imagine the context handler coming handy in other cases too. Devrim -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentation for code readability

2007-03-30 Thread DE
> > I don't understand why you are indenting > the function calls. What does the > indentation and spacing signify? The indentation of function calls increases readability not in the sense that it is easier to decrypt the code, but rather it is analogous to the coordinate system transformations th

Re: Indentation for code readability

2007-03-30 Thread Duncan Booth
"DE" <[EMAIL PROTECTED]> wrote: > Here is what I do in C++ and can not right now in python : > > pushMatrix() > { > drawStuff(); > > pushMatrix(); > { > drawSomeOtherStuff() > } > popMatrix(); > } > popMatrix(); > If I understand this contortion is because

Re: Indentation for code readability

2007-03-30 Thread DE
Thanks Peter. This sounds like to right solution for my case, because in addition to indentation, I can automate push and pop. I'll investigate this further. I appreciate. -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentation for code readability

2007-03-30 Thread Mark Jackson
"DE" <[EMAIL PROTECTED]> writes: > 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 fun

Re: Indentation for code readability

2007-03-30 Thread Steven D'Aprano
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 bracke

Re: Indentation for code readability

2007-03-30 Thread Bjoern Schliessmann
DE wrote: > The curly brackets have no functional meaning but increase the > readability significantly. Personally, I don't think so. It quite explodes the code. Yes, I also indent "BSD style" in my C++ programs. Regards, Björn -- BOFH excuse #175: OS swapped to disk -- http://mail.pyth

Re: Indentation for code readability

2007-03-30 Thread Peter Otten
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 in

Re: Indentation for code readability

2007-03-30 Thread John Machin
On Mar 30, 7:04 pm, "DE" <[EMAIL PROTECTED]> wrote: > Hello, > > Here is what I do in C++ and can not right now in python : > > pushMatrix() > { > drawStuff(); > > pushMatrix(); > { > drawSomeOtherStuff() > } > popMatrix();} > > popMatrix(); > > The curly bracke

Re: Indentation for code readability

2007-03-30 Thread Thomas Krüger
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 i

Indentation for code readability

2007-03-30 Thread DE
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