Hi, When looking at some code with Bertrand, we found that indentation rule was not clear and not always the same. As the indentation is the only expection to the PEP8 [1], I would like to clarrify the situation especially because the wiki page is not clear [2]. Sometimes we indent with 4 spaces and other times with 4 spaces, I think this is wrong. We should always indent with 4 spaces. Sometimes the closing bracket is indented by -4 spaces and other times not.
Here is some examples: http://hg.tryton.org/modules/sale/file/9323deebab09/sale.py#l40 Closing is at the same level as the state definition, this can give the thought that it is starting a new field. I think the closing bracket should be at the same level of indentation as the content. http://hg.tryton.org/modules/sale/file/9323deebab09/sale.py#l1141 Here there is an indentation of 8 spaces but this doesn't give a better readability of the code. I think we should always indent by 4 spaces. So as a algorithm is worth a thousand words, I have adapted the python.vim indent program to match this rules. You can download it at [3] (to install, just copy it in ~/.vim/indent/python.vim). Thanks for testing and report issues. [1] http://www.python.org/dev/peps/pep-0008/ [2] http://code.google.com/p/tryton/wiki/CodingGuidelines [3] http://www.b2ck.com/~ced/python.vim -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: cedric.kr...@b2ck.com Website: http://www.b2ck.com/
pgp2xnbcEgVa5.pgp
Description: PGP signature