Tabs -vs- Spaces: Tabs should have won.

Andrew Berg bahamutzero8825 at gmail.com
Sun Jul 17 02:29:30 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

On 2011.07.16 06:52 PM, Cameron Simpson wrote:
> Only for leading indentation, not following indentation. Consider 
> docstrings and other stuff with embedded fixed witdh layout.
I try to avoid aligning things unless not doing it really hurts
readability for that reason. For example, in most of my source files, I
use tabs to indent. Since Python won't allow a mix of tabs and spaces
(for whitespace) on one line, I don't try to align things:

		else:
			self.x264_cmd = [
				self.x264_exe, self.avs_file,
				'--fps', self.fpsr,
				'--sar', self.sar,
				'--crf', self.crf,
				'--level', self.level,
				'--keyint', self.ki,
				'--min-keyint', self.minki,
				'--ref', self.ref,
				'--weightp', self.weightp,
				'--bframes', self.bframes,
				'--b-adapt', self.badapt,
				'--me', self.me,
				'--merange', self.merange,
				'--direct', self.direct,
				'--trellis', self.trellis,
				'--subme', self.subme,
				'--deblock', self.deblock,
				'--output', self.video_output
				]

But it's still very readable.

However, when alignment really matters, such as in a module's setup.py,
spaces are the way to go:

from distutils.core import setup

setup(
    name         = 'Elucidation',
    version      = '0.0.1-WIP',
    py_modules   = ['elucidation'],
    author       = 'Andrew Berg',
    author_email = 'bahamut at digital-signal.net',
    url          = '',
    platforms    = 'Windows',
    description  = 'Provides a class for storing information on
multimedia files that are to be converted or remuxed and methods to
convert and remux using popular tools.'
    )


Of everything I've read on tabs vs. spaces, this is what makes the most
sense to me:
http://www.iovene.com/61/

- -- 
CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0
PGP/GPG Public Key ID: 0xF88E034060A78FCB
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAwAGBQJOIizqAAoJEPiOA0Bgp4/Lz3MH/2intDlRrMNNtfnyJF384/yS
+dDptVATyTfFYlEGYhVAc1DZHWC2574ZPlB+rPQd8EnDuawGgFtq0h+5m2oMrWTV
dG+53im/TD3t9vU8ElsQ4gdINV99bw2jASJA2zrFwUS7QWAadqHWfZji1JgJkp+k
BupqXbBWaKZn9tREDbWNeTp3byHD0WFs6ZZp5ZxRxYCMNl4I4YMWgkSQuRmQJRy+
3FuFokUz9uyCQk/pHD9JSQqiB2mkXBLZbXU0V71rTBqGIWe+u0n+DggWAAYNAK5R
U+neKJAfwHfwNcgCI0r56gNl1fWc5cOXzT7HcPW4cErvgsBXOOGicPoxZTZZ05I=
=6w/9
-----END PGP SIGNATURE-----



More information about the Python-list mailing list