Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
Christopher Weimann wrote: On 05/19/2006-07:18AM, Duncan Booth wrote: My experience of programming with either spaces or tabs has taught me that tabs are evil not for themselves, but simply because no matter how hard you try they always end up being mixed with spaces. Swap the word 'tabs' for the word 'spaces' and you get... My experience of programming with either tabs or spaces has taught me that spaces are evil not for themselves, but simply because no matter how hard you try they always end up being mixed with tabs. Which is just as vaild as the un-swapped paragraph. Both versions express a bias. The first is biased in favor of spaces. The second is biased in favor of tabs. Neither have any useful content. Mixing is bad but that fact doesn't favor spaces OR tabs. The difference is that you cannot code without spaces but you can do it without tabs. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On Thu, 18 May 2006 08:30:03 +, Duncan Booth wrote: PoD wrote: How many levels of indentation does 12 spaces indicate? It could be 1,2,3,4,6 or 12. If you say it's 3 then you are _implying_ that each level is represented by 4 spaces. By reading the code I can see how many levels of indentation it represents. How many levels of indentation is 3 tabs? 3 levels in any code that you will find in the wild. No. That is precisely the problem: there is code in the wild which contains mixed space and tab indentation, and any time that happens 3 tabs could mean any number of indentations. I think it is universally accepted that mixed tabs and spaces is indeed **EVIL** I should have said any code using tabs exclusively. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On Thu, 18 May 2006 10:33:58 +0200, Christophe wrote: PoD a écrit : On Wed, 17 May 2006 21:37:14 +0800, Andy Sy wrote: If tabs are easily misunderstood, then they are a MISfeature and they need to be removed. From the Zen of Python: Explicit is better than implicit... In the face of ambiguity, refuse the temptation to guess... Special cases aren't special enough to break the rules... Exactly. How many levels of indentation does 12 spaces indicate? It could be 1,2,3,4,6 or 12. If you say it's 3 then you are _implying_ that each level is represented by 4 spaces. Actually, who said you had to always use the same number of spaces to indent ? 12 = 6 + 6 = 4 + 4 + 4 but also 12 = 2 + 10 = 1 + 1 + 3 + 3 + 4 :D Thus supporting my assertion that space indenting is implicit not explicit. Spaces are evil. How many levels of indentation is 3 tabs? 3 levels in any code that you will find in the wild. No, it could be 3 levels or 3 tabs per level or 2 tabs for the first level and 1 tab for the second ... Could be but wouldn't be. Maybe what Python should do (but never will given the obsession with using spaces) is only allow one level of indentation increase per block so that def foo(): TABTABreturn 'bar' would return a syntax error -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
PoD wrote: I think it is universally accepted that mixed tabs and spaces is indeed **EVIL** I should have said any code using tabs exclusively. Can you point at any significant body of publically visible Python code which uses tabs exclusively? All of the Python projects I've ever been involved with use spaces only as a convention (although as I pointed out in my previous post, some with more success than others). The problem with conventions such as 'tabs only' or 'space only' is that they only work if everyone sticks to the conventions, and it helps if the same conventions are in place everywhere (otherwise people forget when they switch from one project to another). Also, in the open source universe you are quite likely to pull in bits of code from other projects, and you don't want to either have to reformat it or to switch your editor settings for some files. My experience of programming with either spaces or tabs has taught me that tabs are evil not for themselves, but simply because no matter how hard you try they always end up being mixed with spaces. Do you know of any open-source projects which actually try to enforce a 'tab only' convention for Python? I'd really like to see a similar scan over some 'tab only' code as I did over Plone to see whether they actually manage to remain 'pure'. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
PoD a écrit : Maybe what Python should do (but never will given the obsession with using spaces) is only allow one level of indentation increase per block so that def foo(): TABTABreturn 'bar' would return a syntax error Which would make TAB mandatory for indentation. What about some freedom of choice ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
Duncan Booth enlightened us with: Can you point at any significant body of publically visible Python code which uses tabs exclusively? Everything Python at http://www.stuvel.eu/software Also, in the open source universe you are quite likely to pull in bits of code from other projects, and you don't want to either have to reformat it or to switch your editor settings for some files. If I grab a module, I just leave the module as is. If I grab a code snippet, I always reformat it to my own style. That's very easy using VIM's retab command. Do you know of any open-source projects which actually try to enforce a 'tab only' convention for Python? My software is, although I'm still the only one working on them ;-) Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? Frank Zappa -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On 19 May 2006 07:18:03 GMT in comp.lang.python, Duncan Booth [EMAIL PROTECTED] wrote: [...] My experience of programming with either spaces or tabs has taught me that tabs are evil not for themselves, but simply because no matter how hard you try they always end up being mixed with spaces. That's been my experience as well. At least on projects with more than one programmer. And more than once with single-programmer projects where the programmer changed or updated his editor in the middle... Regards, -=Dave -- Change is inevitable, progress is not. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On Fri, 19 May 2006 10:04:15 +0200, Christophe wrote: PoD a écrit : Maybe what Python should do (but never will given the obsession with using spaces) is only allow one level of indentation increase per block so that def foo(): TABTABreturn 'bar' would return a syntax error Which would make TAB mandatory for indentation. What about some freedom of choice ? Hey, if people are allowed to say that tabs should be banned, then I'm allowed to say they should be mandatory ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On 19 May 2006 07:18:03 GMT, Duncan Booth [EMAIL PROTECTED] Can you point at any significant body of publically visible Python code which uses tabs exclusively? All of the Python projects I've ever been involved with use spaces only as a convention (although as I pointed out in my previous post, some with more success than others). Dabo. http://dabodev.com -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On 05/19/2006-07:18AM, Duncan Booth wrote: My experience of programming with either spaces or tabs has taught me that tabs are evil not for themselves, but simply because no matter how hard you try they always end up being mixed with spaces. Swap the word 'tabs' for the word 'spaces' and you get... My experience of programming with either tabs or spaces has taught me that spaces are evil not for themselves, but simply because no matter how hard you try they always end up being mixed with tabs. Which is just as vaild as the un-swapped paragraph. Both versions express a bias. The first is biased in favor of spaces. The second is biased in favor of tabs. Neither have any useful content. Mixing is bad but that fact doesn't favor spaces OR tabs. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On Wed, 17 May 2006 21:37:14 +0800, Andy Sy wrote: If tabs are easily misunderstood, then they are a MISfeature and they need to be removed. From the Zen of Python: Explicit is better than implicit... In the face of ambiguity, refuse the temptation to guess... Special cases aren't special enough to break the rules... Exactly. How many levels of indentation does 12 spaces indicate? It could be 1,2,3,4,6 or 12. If you say it's 3 then you are _implying_ that each level is represented by 4 spaces. How many levels of indentation is 3 tabs? 3 levels in any code that you will find in the wild. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
PoD wrote: How many levels of indentation does 12 spaces indicate? It could be 1,2,3,4,6 or 12. If you say it's 3 then you are _implying_ that each level is represented by 4 spaces. By reading the code I can see how many levels of indentation it represents. How many levels of indentation is 3 tabs? 3 levels in any code that you will find in the wild. No. That is precisely the problem: there is code in the wild which contains mixed space and tab indentation, and any time that happens 3 tabs could mean any number of indentations. Now, I just know someone is going to challenge me over my assertion that there really could be code with mixed spaces and tabs out there, so here are a few examples found by grepping a Plone Products folder. All the projects below use spaces almost everywhere for indentation, but it looks like a few tabs slipped through. http://svn.plone.org/view/archetypes/Archetypes/trunk/BaseUnit.py?rev=5111view=auto contains tabs at the start of two lines. Fortunately these are continuation lines so it doesn't really matter how you display them. I think they are intended to be displayed with tab-size=8. http://svn.plone.org/view/archetypes/Archetypes/trunk/Storage/__init__.py?rev=4970view=auto One tab used for indentation. The block is only one line long so the code doesn't break whatever tabsize you use, but visually it would appear the intended tabsize is 0. http://svn.plone.org/view/plone/CMFPlone/trunk/skins/plone_scripts/computeRelatedItems.py?rev=9836view=auto A tab is used for two levels of indentation. Anything other than tabsize=8 would cause a syntax error. http://svn.plone.org/view/plone/CMFPlone/trunk/skins/plone_scripts/computeRoleMap.py?rev=9836view=auto Lots of tabs, most but not all on continuation lines. The two which aren't are on single line blocks with a single tab representing two indents. CMFPlone\tests\testInterfaces.py CMFPlone\tests\testTranslationServiceTool.py ExternalEditor (various files) kupu (spellcheck.py) and finally, at the end of my Plone Products directory I found this beauty where I've replaced the tab characters with tab to make them visible: svn://svn.zope.org/repos/main/Zelenium/trunk/scripts/tinyWebServer.py if __name__ == '__main__': tabport = PORT tabif len(sys.argv) 1: tabport = int(sys.argv[1]) tab server_address = ('', port) tabhttpd = BaseHTTPServer.HTTPServer(server_address, HTTPHandler) tabprint serving at port, port tabprint To run the entire JsUnit test suite, open tabprint http://localhost:8000/jsunit/testRunner.html?testPage=http://localhost:8000/tests/JsUnitSuite.htmlautoRun=true; tabprint To run the acceptance test suite, open tabprint http://localhost:8000/TestRunner.html; tabwhile not HTTPHandler.quitRequestReceived : tabhttpd.handle_request()tab tab This is a genuine example of code in the wild which will look like syntactically valid Python at either tab-size=4 or tab-size=8, but if you view it at tab-size=4 you will see different block indentation than the Python interpreter uses at tab-size=8. At tab-size=4 it reads: if __name__ == '__main__': port = PORT if len(sys.argv) 1: port = int(sys.argv[1]) server_address = ('', port) httpd = BaseHTTPServer.HTTPServer(server_address, HTTPHandler) print serving at port, port print To run the entire JsUnit test suite, open print http://localhost:8000/jsunit/testRunner.html?testPage=http://localhost:8000/tests/JsUnitSuite.htmlautoRun=true; print To run the acceptance test suite, open print http://localhost:8000/TestRunner.html; while not HTTPHandler.quitRequestReceived : httpd.handle_request() but at tab-size=8 it reads: if __name__ == '__main__': port = PORT if len(sys.argv) 1: port = int(sys.argv[1]) server_address = ('', port) httpd = BaseHTTPServer.HTTPServer(server_address, HTTPHandler) print serving at port, port print To run the entire JsUnit test suite, open print http://localhost:8000/jsunit/testRunner.html?testPage=http://localhost:8000/tests/JsUnitSuite.htmlautoRun=true; print To run the acceptance test suite, open print http://localhost:8000/TestRunner.html; while not HTTPHandler.quitRequestReceived : httpd.handle_request() I wouldn't have a problem with tabs if Python rejected mixed indentation by default, because then none of the code above would execute. But it doesn't. :( Anyone got a subversion checkin hook to reject mixed indentation? I think that big repositories like Zope and Plone could benefit from it. I just ran the same grep on the Python source tree. Not a tab in sight. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
PoD a écrit : On Wed, 17 May 2006 21:37:14 +0800, Andy Sy wrote: If tabs are easily misunderstood, then they are a MISfeature and they need to be removed. From the Zen of Python: Explicit is better than implicit... In the face of ambiguity, refuse the temptation to guess... Special cases aren't special enough to break the rules... Exactly. How many levels of indentation does 12 spaces indicate? It could be 1,2,3,4,6 or 12. If you say it's 3 then you are _implying_ that each level is represented by 4 spaces. Actually, who said you had to always use the same number of spaces to indent ? 12 = 6 + 6 = 4 + 4 + 4 but also 12 = 2 + 10 = 1 + 1 + 3 + 3 + 4 :D How many levels of indentation is 3 tabs? 3 levels in any code that you will find in the wild. No, it could be 3 levels or 3 tabs per level or 2 tabs for the first level and 1 tab for the second ... -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
Duncan Booth wrote: No. That is precisely the problem: there is code in the wild which contains mixed space and tab indentation... followed by some good examples of mixed tab and space indentation I wouldn't have a problem with tabs if Python rejected mixed indentation by default, because then none of the code above would execute. I think it's great that at least we're all agreed that mixed indentation is a bad idea in any code, and particularly in Python. How would people feel about having the -t (or even -tt) behaviour become the default in future Python releases? A legacy option would obviously need to be provided for the old default behaviour. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
If tabs are easily misunderstood, then they are a MISfeature and they need to be removed. From the Zen of Python: Explicit is better than implicit... In the face of ambiguity, refuse the temptation to guess... Special cases aren't special enough to break the rules... -- It's called DOM+XHR and it's *NOT* a detergent! -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On 5/17/06, Andy Sy [EMAIL PROTECTED] wrote: If tabs are easily misunderstood, then they are a MISfeature and they need to be removed. I don't seem to understand your point in acting as a dictator. Therefore, you are a MISfeature and need to be removed. -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
Peter Decker wrote: On 5/17/06, Andy Sy [EMAIL PROTECTED] wrote: If tabs are easily misunderstood, then they are a MISfeature and they need to be removed. I don't seem to understand your point in acting as a dictator. Therefore, you are a MISfeature and need to be removed. Is the above an example of how a tab-user exercises 'logic'...? Besides, I'm not the only dictator here... there are also the: 4-space tabs dictators... 8-space tabs dictators... etc... -- It's called DOM+XHR and it's *NOT* a detergent! -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On 5/17/06, Andy Sy [EMAIL PROTECTED] wrote: Peter Decker wrote: On 5/17/06, Andy Sy [EMAIL PROTECTED] wrote: If tabs are easily misunderstood, then they are a MISfeature and they need to be removed. I don't seem to understand your point in acting as a dictator. Therefore, you are a MISfeature and need to be removed. Is the above an example of how a tab-user exercises 'logic'...? Uh, I should know better than to try to educate, but FYI: using the same argument construction and having it reach an invalid conclusion suffices to show that the original construction is invalid, and thus the original conclusion is suspect. -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
Peter Decker wrote: On 5/17/06, Andy Sy [EMAIL PROTECTED] wrote: Peter Decker wrote: On 5/17/06, Andy Sy [EMAIL PROTECTED] wrote: If tabs are easily misunderstood, then they are a MISfeature and they need to be removed. I don't seem to understand your point in acting as a dictator. Therefore, you are a MISfeature and need to be removed. Is the above an example of how a tab-user exercises 'logic'...? Uh, I should know better than to try to educate, but FYI: using the same argument construction and having it reach an invalid conclusion suffices to show that the original construction is invalid, and thus the original conclusion is suspect. I guess this *REALLY* is how a misguided tab user exercises his 'logic': Syntax replication (e.g. so-called 'argument construction') is enough, semantics don't matter. ROTFLMAO! -- It's called DOM+XHR and it's *NOT* a detergent! -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
On 5/17/06, Andy Sy [EMAIL PROTECTED] wrote: Uh, I should know better than to try to educate, but FYI: using the same argument construction and having it reach an invalid conclusion suffices to show that the original construction is invalid, and thus the original conclusion is suspect. I guess this *REALLY* is how a misguided tab user exercises his 'logic': Syntax replication (e.g. so-called 'argument construction') is enough, semantics don't matter. ROTFLMAO! My instincts were correct: it is foolhardy to attempt to educate closed minds. twitfilter status=on -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)
Andy Sy I guess this *REALLY* is how a misguided tab user exercises his 'logic': Syntax replication (e.g. so-called 'argument construction') is enough, semantics don't matter. That's quite amusing.. you've unwittingly stumbled on a pretty concise statement of Hilbert's first postulate of formal logic, proved by Godel in 1930.. ROTFLMAO! Indeed. -- http://mail.python.org/mailman/listinfo/python-list