Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20777

Re: Please verify!!

Date 2012-02-23 21:45 -0600
From Andrew Berg <bahamutzero8825@gmail.com>
Subject Re: Please verify!!
References <724ccbd6-30d1-41bd-bf38-2a5ce82953a1@x19g2000yqh.googlegroups.com> <4F46C124.2070102@davea.name>
Newsgroups comp.lang.python
Message-ID <mailman.106.1330055156.3037.python-list@python.org> (permalink)

Show all headers | View raw


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 
> editor.
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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Please verify!! Manish Sharma <manish2aug@gmail.com> - 2012-02-23 14:13 -0800
  Re: Please verify!! Ben <bungiman@gmail.com> - 2012-02-23 14:29 -0800
  Re: Please verify!! Dave Angel <d@davea.name> - 2012-02-23 17:43 -0500
  Re: Please verify!! Joshua Miller <milleja46@gmail.com> - 2012-02-23 20:57 -0500
  Re: Please verify!! Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-23 21:45 -0600
    Re: Please verify!! Ben Finney <ben+python@benfinney.id.au> - 2012-02-24 19:32 +1100
      Re: Please verify!! Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-24 03:18 -0600
        Re: Please verify!! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-24 12:20 +0000
          Re: Please verify!! Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-24 07:20 -0600
          Re: Please verify!! Chris Angelico <rosuav@gmail.com> - 2012-02-25 07:41 +1100
          Re: Please verify!! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-02-25 00:49 +0000
          Re: Please verify!! Chris Angelico <rosuav@gmail.com> - 2012-02-25 12:25 +1100
          Re: Please verify!! Dave Angel <d@davea.name> - 2012-02-24 21:36 -0500
    Re: Please verify!! Duncan Booth <duncan.booth@invalid.invalid> - 2012-02-24 11:21 +0000
      Re: Please verify!! Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-24 05:36 -0600
  Re: Please verify!! Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-24 01:26 -0600
  Re: Please verify!! Jugurtha Hadjar <jugurtha.hadjar@gmail.com> - 2012-02-24 12:10 +0100

csiph-web