I hate you all

terminatorul at gmail.com terminatorul at gmail.com
Fri Apr 5 18:04:52 EDT 2013


On Saturday, April 6, 2013 12:55:29 AM UTC+3, John Gordon wrote:
> In <64d4fb7c-6a75-4b5f-b5c8-06a4b2b5d0cb at googlegroups.com> terminatorul at gmail.com writes:
> 
> > How can python authors be so arrogant to impose their tabs and spaces
> > options on me ? It should be my choice if I want to use tabs or not !
> 
> You are free to use tabs, but you must be consistent.  You can't mix
> tabs and spaces for lines of code at the same indentation level.

They say so, but python does not work that way. This is a simple script:

from unittest import TestCase

class SvnExternalCmdTests(TestCase) :
    def test_parse_svn_external(self) :
	for sample_external in sample_svn_externals :
	    self.assertEqual(parse_svn_externals(sample_external[0][0], sample_external[0][1]), [ sample_external[1] ])

And at the `for` statement at line 5 I get:

C:\Documents and Settings\Adrian\Projects>python sample-py3.py
  File "sample-py3.py", line 5
    for sample_external in sample_svn_externals :
                                                ^
TabError: inconsistent use of tabs and spaces in indentation


Line 5 is the only line in the file that starts at col 9 (after a tab). Being the only line in the file with that indent level, how can it be inconsistent ?

You can try the script as it is, and see python 3.3 will not run it



More information about the Python-list mailing list