[Python-ideas] Pipe indentation

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Dec 9 16:17:36 CET 2013


On 09/12/2013 10:29, Daniel Watkins wrote:
> On Mon, Dec 09, 2013 at 09:11:09PM +1100, Chris Angelico wrote:
>> On Mon, Dec 9, 2013 at 9:07 PM,  <musicdenotation at gmail.com> wrote:
>>> if condition:
>>> | do_this
>>> | if cond2:
>>> | |do_that
>>> else:
>>> | do_this_instead
>>>
>>> This has the advantage of you always knowing which nesting level you are.
>>
>> Alternative suggestion: Tab indentation. Do exactly the same thing,
>> but replace every pipe with a tab. Then you can set your editor to
>> show indentation visibly (SciTE does this already).
>
> Alternative suggestion: indent with 4 spaces.  Do exactly the same
> thing, but replace every pipe with 4 spaces.  Then you can set your eyes
> to see the visible indentation.
>
> ;)
>
>
> More seriously, if you are at the point where you're getting confused by
> levels of indentation, you're probably either (a) nesting too much, or
> (b) including too much in indented blocks.  Either of these can be
> solved by splitting your code up in to more smaller functions/methods
> (which, if you name them well, will have the side-effect of making your
> code clearer anyway!).
>
>
> Cheers,
>
> Dan

Alternative alternative alternative suggestion don't post items like 
this as I've just barfed all over my screen :(

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence



More information about the Python-ideas mailing list