Tabs -vs- Spaces: Tabs should have won.

Andrew Berg bahamutzero8825 at gmail.com
Sun Jul 17 09:29:07 CEST 2011


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

On 2011.07.16 06:06 PM, Tim Roberts wrote:
> That's not true.  Python allows tabs and spaces to be used in the
> same source file, and even in the same source line.
You're right. TabError is only raised if the initial indentation is
inconsistent.
Not legal:
def spam():
<tab>print('Wonderful spam!\n')
<4 spaces>print('Bloody Vikings!')

Legal:
def eggs():
<tab>print(
<tab><tab>'Blech!\n',<some spaces to align>'Whaddya mean, "blech"?\n',
<tab><tab>'I don\'t like spam!\n',<spaces to align>'...'
<tab><tab>)

> I'm not saying it's wise
Why not?

- -- 
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/

iQEcBAEBAwAGBQJOIo9DAAoJEPiOA0Bgp4/LOk4IALdGAOb3RXyunzWiDBn3vNpr
fIR7NdtFmNc1QtvxGm3RVV+wxUjVjeCv5bXuAr/RvYDWm+MRCCr+VbexV52sFAbm
2G1g4rWQnRPGXvDMTq1bjJKcYFnJga/LHBqnM0mWTAms6o4d+Pj5ZJ5uK5CsFcx+
oL7y3YuVrtw/hYRNqTaxhMMy3erayGt4h3sEDIaekNbaNwNFy/7M6+tFzPBNHupT
EZAjkVewIDEgRqd+hCZfuanuS4mX6P2pup1dgAUiMAjEXRJO4xQ1JmmuCVXiccE/
HyiPtiIsTorDGGtzkaSpBwc1RVeZEeluO+VeVt9pIGCupKnDcVty+1R1C1kmS2U=
=QXtI
-----END PGP SIGNATURE-----



More information about the Python-list mailing list