Python indent - how do you do it?

A space, a tab? Just currious what, why, you indent in x way?

Fwiw, I use vi, so kind'a currious how you vi folks approach indentation when writing code (eg python).

Disclosure, I'm just learning python and have never seen a language use indentation so formally (I like it too:) ). I just don't want to get too far down the road programming in say python adding x spaces to indent when most do y spaces or use tabs...

Just looking for some intel from ya. Happy weekend all!

I use spaces and vi's autoindent feature.

: set ai

Disclaimer: I'm somewhat a novice to python. I prefer spaces, but my understanding is that tabs are better. If you use spaces, and some else wants to read your code, and they don't use spaces, there's no clean way to reformat the code to their preferences. But, if you use tabs, then, it's just a matter of changing how tabs are displayed which can be customized without affecting the source code at all.

I usually use tabs, quick and convenient...

I use tabs too. I feel that the code appearance is elegant if tabs are used for indentation.

Thanks folks for the chat re your practice! I'm glad to hear there isn't some unwritten rule that it's X way or the highway!

Think since I'm a big sas and sql guy, I'll stick with tab. Glad I won't be some python-outlaw or whatnot using tab:)

In case it's of any interest to you: PEP 8 -- Style Guide for Python Code

Regards,
Alister

^ Hold the press folks....

We've a ruling....

As per above link....

Well that settles that, thanks Alister! 4-space it is for me then. When in Rome...

Is there any macro or whatnot in vi that auto-spaces-4?