bahamutzero8825 at gmail.com
Fri Feb 24 04:45:24 CET 2012
On 2/23/2012 4:43 PM, Dave Angel wrote:
> First thing I'd do is to disable tab logic in the editor. When you
> press the tab key, there's no excuse for an editor to actually put a tab
> in the file. It should adjust the column by adding the appropriate
> number of spaces.
Unless, of course, you know, you actually /want/ to use tabs (the
horror!). The decision whether to use tabs or spaces shouldn't be made
for the novice programmer. Make an argument, explain the
advantages/disadvantages, whatever, but don't state your opinion like
it's fact. Even worse, you brought it up in the context of editor
issues, making it sound like using tabs is a common source of problems.
Much of it is personal preference (I could give objective reasons in
support of tabs in Python, but I don't intend to start the whole spaces
vs. tabs discussion again).
> The main place you get in trouble is when a file has
> tabs in some lines, and uses spaces for indenting on other lines.
I wouldn't call it the main problem, but yes, that happens. It's not
terribly difficult to convert all indentation to tabs or spaces (unless
the number of spaces used to indent is inconsistent).
> As Amirouche has pointed out, line endings can be inconsistent between
> different operating systems, and not all editors can handle the
> differences. But the python compiler/interpreter doesn't care about
> which line ending is used.
Yes. However, there are many editors for various platforms that handle
the different line endings just fine. In fact, Notepad is the only
editor I can think of off the top of my head that has an issue.
> One other issue could be files that have non-ASCII characters. Since a
> text file has no standard way to indicate what format it uses (utf8,
> ucs2, or dozens of "extended ASCII" encodings), another editor might not
> deal with it correctly. There is a standard way to indicate to Python
> how to interpret non-ascii characters, so if you either 1) always use
> ASCII1 2) always use the same character encoding, or 3) have your editor
> look for the declaration and honor it, you'd have no trouble.
I recommend using UTF-8 always unless there's some reason not to.
> If these problems do occur, they'll be pretty easy to spot. And you can
> always revert to an earlier version, by using your revision control
> system. Enabling one of those is about as important as choosing your
I don't think you can really go wrong outside of Git, Bazaar, or
Mercurial. Which of those 3 is best is mainly personal preference.
CVS/SVN should be considered legacy and not suitable for new projects.
CPython 3.2.2 | Windows NT 6.1.7601.17640
More information about the Python-list