Proposal: Official whitespace response
Thomas A. Bryan
tbryan at python.net
Wed Feb 16 05:57:17 EST 2000
Forrest Cahoon wrote:
>
> In article <200002102304.KAA08105 at envy.fulcrum.com.au>,
> Richard.Jones at fulcrum.com.au wrote:
> >
> > Could we please maybe mandate an "Official Response" to the weenies
> > constantly posting about whitespace in Python?
> As a "newbie" who made such a post recently, I can tell you what would
> have been useful to me ... indeed, what would have made me feel it was
> unnecessary to post.
>
[...snip...]
> Inbetween all the bickering, I got a lot of useful information. It
> would be nice to summarize these points in a succinct, factual manner.
Well, the Python FAQ Wizard empowers the PSA members to do something
about this situation. I skipped most of the thread this time, but if
*you* could tell me what useful information you got out of that thread,
I'll summarize it and add it to the FAQ.
I propose two entries. One in the Programming Python in the FAQ section
that deals with practical issues of dealing with whitespace in Python
programs and one in the Python's Design section that deals with the
fact that this isn't likely to change, that the majority of Python
programers like it as it currently is, and that it has been discussed
many times on comp.lang.python.
> I don't know why this is so hidden. I think any reasonable FAQ on the
> matter must state, in some obvious and up-front way THE PYTHON
> INTERPRETER ALWAYS INTERPRETS A TAB AS 8 SPACES.
Agreed.
[...snip...]
> You can pooh-pooh the objections to using indentation as syntax, but you
> can't pooh-pooh the importance of understanding the mechanics of how it
> is implemented! Yet most of you pythoneers (who respond at all -- no
> doubt many more are coding) would rather spend your time explaining why,
> philosophically, it's not a problem, instead of describing how
> indentation-as-syntax actually works.
True. So let's get it into the FAQ once and for all.
> (Personally, I'd feel more secure about python if tabs generated a
> compile error, and thus could be guaranteed not to be in any running
> code.)
Some people don't use spaces for indentation and use *only* tabs.
That way, they can set the "size" of the tab in their editor and
see their code with more or less separation. I suspsect that the
-t option is what you really want.
> The second thing of interest I learned is that there is a module called
> pyindent.py (?) that is supposed to allow me to put redundant
> information in my python code, if I'm really so silly as to be worried
> about this whitespace thing. Yes, I'm really that silly. I'll probably
> use pyindent.py (is that what it was called?) More information would be
> appreciated.
Do you mean tabnanny.py or pindent.py? They should be in Tools/scripts
directory of the Python source download. See the comments at the beginning
of pindent.py to see what it does.
> The third thing related to this issue that was educational for me was
> the emacs python-mode keybindings that help deal with indentation.
Great for all of us who use Emacs! And the help provided by the mode is
first rate: just hit C-c ? when in Python mode.
> So, yeah, write your position paper, say it's not a problem, whatever --
> but put these facts in it. At least, that's my advice.
> ... and I've probably written 30 lines of python by now!!!!
once-you-start-down-the-python-path
-forever-will-it-dominate-your-destiny-ly yours
Tom
More information about the Python-list
mailing list