Completely INNOCENT Indentation question

valued customer scooterm at hotmail.com
Thu Oct 14 05:28:00 CEST 2004


> > Is there a way in python to indicate that you want your 
> > "base level of indentation" to be four spaces instead of
> > zero?

> I don't think so.  Just out of curiosity, why would you want to do that?

The question was just to make sure I hadn't overlooked some
feature or setting of the programming language that would enable
what I had asked about (short of introducing any of the various
language constructs that we all can imagine and you need not 
elaborate here).

As far as 'why would anyone want to do that' one reason that 
never fails is *personal preference* ... there probably isn't
a stylistic or programming practice in existence that can't be 
explained at least partially by that. Therefore if someone asks,
there must be at least *that* reason.

For those who are not satisfied with that kind of answer, here
is an example: 

Suppose you are editing source code in such a way
that you only want *comments* to be flush left, and the rest of
the code to be indented. 

(but Why would you want do that?)

Because you work with a text editor that shows an 'outline' 
of your code based on the indentation, and you want the outline
structure to be reflected in the comments.

### documentation
    """ This is a python script that does some stuff.
    Not only does it do stuff, it's documented stuff. 
    """
### initialize python
    import foo
    import bar

### do some stuff
    print foo.frobilize()

### do some other stuff
    print bar.babelize()

### end of python


Yes the question may remain ... why would anyone wanna do 
that? Well, there are reasons. Whatever the justifications
may be, the 'additional language statements' workaround will
apparently have to suffice.

Thanks for the input though.



More information about the Python-list mailing list