473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

All leading tabs or all leading spaces - why isn't that enforced?

One can argue over tab vs. space indentation, but mixing the two
is just wrong. Why not have CPython report an error if a file has
both leading tabs and leading spaces? I know that was proposed at
some point, but I don't think it ever went in. That would catch a
common error introduced during maintenance.

John Nagle
Aug 7 '07 #1
4 1409
John Nagle wrote:
One can argue over tab vs. space indentation, but mixing the two
is just wrong. Why not have CPython report an error if a file has
both leading tabs and leading spaces? I know that was proposed at
some point, but I don't think it ever went in. That would catch a
common error introduced during maintenance.
I suppose we Pythonistas are just too permissive for our own good.
Consider the opportunity to use mixed tabs and spaces a piece of rope of
your preferred length ...

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

Aug 7 '07 #2
I suppose we Pythonistas are just too permissive for our own good.
Consider the opportunity to use mixed tabs and spaces a piece of rope of
your preferred length ...
I thought I remembered reading somewhere that Python 3000 will ban tabs
as indentation characters, but now I can't turn up a link for it...

--
You can't lose what you never had.
Aug 7 '07 #3
On 2007-08-07, Omari Norman <om***@smileystation.comwrote:
>I suppose we Pythonistas are just too permissive for our own good.
Consider the opportunity to use mixed tabs and spaces a piece of rope of
your preferred length ...

I thought I remembered reading somewhere that Python 3000 will
ban tabs as indentation characters, but now I can't turn up a
link for it...
Tabs are going to be banned in the C Style Guide for Python 3000
source code, but they aren't being banned from Python 3000 code.

--
Neil Cerutti
The concert held in Fellowship Hall was a great success. Special thanks are
due to the minister's daughter, who labored the whole evening at the piano,
which as usual fell upon her. --Church Bulletin Blooper
Aug 7 '07 #4
On Tue, 07 Aug 2007 02:53:18 +0000, John Nagle wrote:
One can argue over tab vs. space indentation, but mixing the two is just
wrong. Why not have CPython report an error if a file has both leading
tabs and leading spaces? I know that was proposed at some point, but I
don't think it ever went in. That would catch a common error introduced
during maintenance.
While I agree it should be default, you can enable extra checking with
-tt. Eg.

% jhexdump /tmp/abcd.py
0x00000000: 2321 202F 7573 722F 6269 6E2F 7079 7468 #! /usr/bin/pyth
0x00000010: 6F6E 202D 7474 0A0A 6966 2054 7275 653A on -tt..if True:
0x00000020: 0A09 7072 696E 7420 2261 220A 2020 2020 ..print "a".
0x00000030: 2020 2020 7072 696E 7420 2262 220A print "b".
% /tmp/abcd.py
File "/tmp/abcd.py", line 5
print "b"
^
TabError: inconsistent use of tabs and spaces in indentation
% python /tmp/abcd.py
a
b

....note that this doesn't require all spaces or all tabs, just that
their usage has to be consistent.

--
James Antill -- ja***@and.org
C String APIs use too much memory? ustr: length, ref count, size and
read-only/fixed. Ave. 44% overhead over strdup(), for 0-20B strings
http://www.and.org/ustr/
Aug 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: bearophileHUGS | last post by:
Hello, I know this topic was discussed a *lot* in the past, sorry if it bores you... >From the Daily Python-URL I've seen this interesting Floating Point Benchmark:...
135
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about...
35
by: Ben | last post by:
Hi, I have a python script on a unix system that runs fine. I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. I now want to run them on the...
16
by: Alan Isaac | last post by:
I am brand new to pylint. As a tab user, I want the tabs warning turned off. How? Larger question: where is the config file format documented? Thanks, Alan Isaac
12
by: ibloom | last post by:
I've been trying for a couple days to build a program using pyObjC on a mac, I'm stuck on this error: <string>: inconsistent use of tabs and spaces in indentation Traceback (most recent call...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.