473,756 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Spaces and tabs again

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:
http://www.fourmilab.ch/fourmilog/ar...08/000567.html

This is the source pack:
http://www.fourmilab.ch/fbench/fbench.zip

I've read its Python sourcecode, probably there few things that can be
changed to speed it up some (like moving the main code in a function,
using Psyco, or even vectorizing it with numarray), but I've had
problems in changing the code because it mixes tabs and spaces for the
indentations.
I like a lot how Python uses indentations, I've never had problems with
them in my programs, but I have big problems when I find a source that
mixes them (I often need time to find how much spaces a tab is, to try
to convert them all in spaces).
I know that some people likes tabs, and other people likes spaces, so
probably a single standard cannot be enforced, but I think the python
compiler must generate an error (and stop compiling) when the
sourcecode of a module contains both spaces and tabs to indent the
lines of code (and comments lines too?).

Bye,
bearophile

Aug 13 '05 #1
17 2201
Hallöchen!

be************@ lycos.com writes:
[...] I know that some people likes tabs, and other people likes
spaces, so probably a single standard cannot be enforced, but I
think the python compiler must generate an error (and stop
compiling) when the sourcecode of a module contains both spaces
and tabs to indent the lines of code (and comments lines too?).


I think the interpreter option -tt does this but I've never used it.

I agree that mixing spaces and tabs is a bad thing. Unfortunately,
my default Emacs configuration did so, whyever. I changed it a
couple of days ago. However, the PEP 8 strongly dicourages it
anyway.

Tschö,
Torsten

--
Torsten Bronger, aquisgrana, europa vetus
Aug 13 '05 #2
be************@ lycos.com wrote:
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:
http://www.fourmilab.ch/fourmilog/ar...08/000567.html

This is the source pack:
http://www.fourmilab.ch/fbench/fbench.zip

I've read its Python sourcecode, probably there few things that can be
changed to speed it up some (like moving the main code in a function,
using Psyco, or even vectorizing it with numarray), but I've had
problems in changing the code because it mixes tabs and spaces for the
indentations.
I like a lot how Python uses indentations, I've never had problems with
them in my programs, but I have big problems when I find a source that
mixes them (I often need time to find how much spaces a tab is, to try
to convert them all in spaces).
I know that some people likes tabs, and other people likes spaces, so
probably a single standard cannot be enforced, but I think the python
compiler must generate an error (and stop compiling) when the
sourcecode of a module contains both spaces and tabs to indent the
lines of code (and comments lines too?).

What's wrong with mixing spaces and tabs? Either way, it's pretty easy
to convert back & forth. In Vim:

:set expandtab
:%retab
Aug 13 '05 #3
In article <11************ **********@g44g 2000cwa.googleg roups.com>,
<be************ @lycos.com> wrote:

I know that some people likes tabs, and other people likes spaces, so
probably a single standard cannot be enforced, but I think the python
compiler must generate an error (and stop compiling) when the
sourcecode of a module contains both spaces and tabs to indent the
lines of code (and comments lines too?).


Python 3.0 will prohibit tabs.
--
Aahz (aa**@pythoncra ft.com) <*> http://www.pythoncraft.com/

The way to build large Python applications is to componentize and
loosely-couple the hell out of everything.
Aug 13 '05 #4

Aahz wrote:
<snip>
Python 3.0 will prohibit tabs.
--
Aahz (aa**@pythoncra ft.com) <*> http://www.pythoncraft.com/

The way to build large Python applications is to componentize and
loosely-couple the hell out of everything.


Are you kidding? You are going to MANDATE spaces?

Robert

Aug 13 '05 #5
si*****@gmail.c om wrote:
Are you kidding? You are going to MANDATE spaces?


Actually, future whitespace rules will be extensive. See:
http://64.233.187.104/search?q=cache...hread%3D101968
(google cache of
http://www.artima.com/weblogs/viewpo...?thread=101968 because it
seems to be down at the moment)

The only change from April 1, 2005 is that the enforcement is punted
until Python 3.0, because of the source-incompatible nature of the change.

"Lrf, vg'f na Ncevy Sbbyf' wbxr.".decode(' rot13')
Aug 13 '05 #6
Christopher Subich wrote:
si*****@gmail.c om wrote:
Are you kidding? You are going to MANDATE spaces?

Actually, future whitespace rules will be extensive. See:
http://64.233.187.104/search?q=cache...hread%3D101968

(google cache of
http://www.artima.com/weblogs/viewpo...?thread=101968 because it
seems to be down at the moment)

The only change from April 1, 2005 is that the enforcement is punted
until Python 3.0, because of the source-incompatible nature of the change.

"Lrf, vg'f na Ncevy Sbbyf' wbxr.".decode(' rot13')


Downright unpythonic!

--
"""Va Nhthfg? Gung'f pehry. V nyzbfg jrag onpx gb Crey!

Univat arire frra "GBBJGQV" orsber abj, V nz fgvyy ynhtuvat cerggl uneq.
""".decode('rot 13')
Aug 13 '05 #7
That is rediculous. If that happens...Pytho n comes of my list of
languages to use. Are they going to mandate 4 spaces as well?

Robert

Aug 13 '05 #8
Ah!!! I read it and noticed the date "April 1st". Doh!

Aug 13 '05 #9
On 13 Aug 2005 13:18:21 -0700, si*****@gmail.c om declaimed the following
in comp.lang.pytho n:

Are you kidding? You are going to MANDATE spaces?
After the backlash, Python 4.0 will ban leading spaces and require
tabs <G>

(Especially when M$ decides to ban fixed-width fonts, and uses
micro-spaces such that the difference between one space and eight spaces
is only a display pixel <G>)
-- =============== =============== =============== =============== == <
wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.ne tcom.com/> <

Aug 14 '05 #10

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

Similar topics

1
2044
by: Kevin Auch | last post by:
Hi, I'm working on a little application which analyse source code file from VS.NET. But I'm in front of a big problem. The source generated by VS.NET is automatically "indented", but when I analyse these lines I can't remove the tabs or the spaces at the beginning of the line because it's not spaces or tabs. I tried to change the encoding of my StreamReader but it's always the same...
11
15018
by: gopal srinivasan | last post by:
Hi, I have a text like this - "This is a message containing tabs and white spaces" Now this text contains tabs and white spaces. I want remove the tabs and white spaces(if it more than once between two words). Is there any function we have in C which will find out the tabs and white spaces and returns the text in the follwong way -
2
1747
by: Alan Silver | last post by:
Hello, VWD Express seems obsessed with inserting loads of spaces at the start of each line whenever you drag controls into the source view. I guess this is MS' idea of making the source code readable by indenting it, but it annoys me intensely. Apart from anything else, it causes extra line wrap as the spaces make the line too long to fit in the window. Can I switch off this, erm "feature"? I haven't found a way yet. Please put me out...
135
7508
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 which is better. It has become what's known as “religious war” — a heated fight over trivia. In this essay, i like to explain what is the situation behind it, and which is proper.
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.