Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > All leading tabs or all leading spaces - why isn't that enforced?

Reply
Thread Tools

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

 
 
John Nagle
Guest
Posts: n/a
 
      08-07-2007
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
 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      08-07-2007
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 -------------

 
Reply With Quote
 
 
 
 
Omari Norman
Guest
Posts: n/a
 
      08-07-2007
> 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.
 
Reply With Quote
 
Neil Cerutti
Guest
Posts: n/a
 
      08-07-2007
On 2007-08-07, Omari Norman <(E-Mail Removed)> wrote:
>> 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
 
Reply With Quote
 
James Antill
Guest
Posts: n/a
 
      08-07-2007
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 -- http://www.velocityreviews.com/forums/(E-Mail Removed)
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Tabs -vs- Spaces: Tabs should have won. rantingrick Python 95 07-18-2011 11:07 PM
Re: How to trim a String trailing spaces, but not leading spaces? John B. Matthews Java 4 09-12-2008 05:28 AM
RE: All leading tabs or all leading spaces - why isn't that enforced? Delaney, Timothy (Tim) Python 0 08-07-2007 03:50 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM



Advertisments