Indentation problem

Stephen J. Turnbull stephen at xemacs.org
Tue Mar 26 03:03:47 EST 2002


>>>>> "Isaac" == Isaac To <kkto at csis.hku.hk> writes:

    Isaac> This is somewhat close to what I say, but a little bit off:
    Isaac> it won't reindent to the correct tab width.

C-c > C-M-\ handles your example, but as the docstring for
py-indent-region says, you can't do it generically without telepathy.
Both

    if do_as_i_say:
        do_it()
    do_anyway()

and

    if do_as_i_say:
        do_it()
        do_anyway()

are syntactically valid, but the second is evidently semantically
wrong given the apparent intention of the author.

In my own code I often write

    if do_as_i_say:
        do_it()

    do_anyway()

for the first case for emphasis, but this is not a universally
acceptable solution.

    Isaac> Yes, it is very Python specific.

Well, yes, but python-mode is supposed to be Python-specific.


-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
              Don't ask how you can "do" free software business;
              ask what your business can "do for" free software.



More information about the Python-list mailing list