PEP8 and 4 spaces
Lie Ryan
lie.1296 at gmail.com
Fri Jul 4 14:29:35 EDT 2014
On 04/07/14 07:55, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>
>>> That's exactly the problem with tabs - whatever you think your code
>>> looks like with tabs, other people will see quite different picture.
>>
>> Why do you consider this a problem?
>
> It's a problem if you try to use tabs for lining things
> up in a tabular fashion in your source code.
>
> The solution is not to use tabs for that -- only use
> tabs for indentation, and use spaces for everything
> else. Or, as PEP 8 suggests, don't try to line things
> up in the first place.
PEP8 suggests using this style of method invocation:
obj.method(foo,
bar,
baz)
which is an effect impossible to do correctly with tabs alone. If you
want to follow this style strictly, you end up having to either mix tabs
and spaces, or just use spaces, or as I prefer it, avoid the issue
altogether:
obj.method(
foo,
bar,
baz,
)
More information about the Python-list
mailing list