Re: DOS, UNIX and tabs
Tim Roberts wrote: Ben [EMAIL PROTECTED] wrote: Great - that worked.Thanks! Is that a general method in linux you can always use to redirect standard output to a file? Works in Windows, too. For some value of work :) regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Blog of Note: http://holdenweb.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Steven D'Aprano [EMAIL PROTECTED] wrote: I've spent a lot of time reading both sides of the tabs versus spaces argument, and I haven't found anything yet that explains why tabs are, in and of themselves, bad. +1 for QOTW Searching for the badness of tabs is like searching for the holy grail. You are doomed to failure. You cannot find something that does not exist. : - ) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
On 1/1/07, Tom Plunket [EMAIL PROTECTED] wrote: Maybe I'm also weird, but I use a variable-pitch font when programming in Python. So a tab equals some number of spaces really isn't useful to me. My setup is, tab equals this much space. A year ago I would have thought you were weird, but after reading a post by Ed Leafe, one of the creators of Dabo about using proportional fonts for readability, I thought I'd try it out, thinking that it was pretty wacky. Turns out that after a very brief adjustment period, I liked it! I've been using proportional fonts ever since, and have found only one drawback: code that is indented with spaces looks butt-ugly. I'm glad I switched to tabs for my code. -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
On 2007-01-02, Peter Decker [EMAIL PROTECTED] wrote: On 1/1/07, Tom Plunket [EMAIL PROTECTED] wrote: Maybe I'm also weird, but I use a variable-pitch font when programming in Python. So a tab equals some number of spaces really isn't useful to me. My setup is, tab equals this much space. A year ago I would have thought you were weird, but after reading a post by Ed Leafe, one of the creators of Dabo about using proportional fonts for readability, I thought I'd try it out, thinking that it was pretty wacky. Turns out that after a very brief adjustment period, I liked it! I've been using proportional fonts ever since, and have found only one drawback: code that is indented with spaces looks butt-ugly. I'm glad I switched to tabs for my code. I first came accross it in Stroustrup's _The C++ Programming Language_. I liked the look and the idea immediately, but my editor of choice (by historical accident) Vim, doesn't yet support it. -- Neil Cerutti I've had a wonderful evening, but this wasn't it. --Groucho Marx -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Peter Decker wrote: Maybe I'm also weird, but I use a variable-pitch font when programming in Python. So a tab equals some number of spaces really isn't useful to me. My setup is, tab equals this much space. A year ago I would have thought you were weird, but after reading a post by Ed Leafe, one of the creators of Dabo about using proportional fonts for readability, I thought I'd try it out, thinking that it was pretty wacky. Turns out that after a very brief adjustment period, I liked it! Yep, I had a similar experience although a bit more forced. The editor that I was using was configured out-of-the-box with variable-pitch, and I didn't want to bother figuring out how to change it for the quickie stuff I was writing, then eventually I found that it no longer bothered me... -tom! -- -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Lawrence D'Oliveiro wrote: I think there should be a single environment variable, perhaps called TABS, which specifies the tab settings across all relevant tools that work with text, including less and diff. So for example setting this as export TABS=4 will cause these tools to treat tabs as equivalent to stepping to the next multiple of four columns from the start of the line. Maybe I'm also weird, but I use a variable-pitch font when programming in Python. So a tab equals some number of spaces really isn't useful to me. My setup is, tab equals this much space. -tom! -- -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
In [EMAIL PROTECTED], Paul McNett wrote: Did you try to open your code files with another editor, which has a different length for tabulator chars? It would look quite ugly, I guess... Actually, no. Everyone can choose their own number of spaces-per-tab and it'll look right, as long as everyone uses a monospace font. You never tried that with tabs plus additional spaces to line up e.g. arguments that are broken across lines, right? And there are a number of environments where you can't change the length of a tab like email or terminals where code will be displayed from time to time for example as diffs from a version control system. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
In message [EMAIL PROTECTED], Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Paul McNett wrote: Everyone can choose their own number of spaces-per-tab and it'll look right, as long as everyone uses a monospace font. You never tried that with tabs plus additional spaces to line up e.g. arguments that are broken across lines, right? I prefer a more two-dimensional layout, keeping consistent indentation. To illustrate using the example from Paul McNett: class Apple(object): def contrived_example_function \ ( self, argument1, argument2, argument3, argument4 ) : print hello, world #end contrived_example_function #end Apple -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Marc 'BlackJack' Rintsch wrote: Did you try to open your code files with another editor, which has a different length for tabulator chars? It would look quite ugly, I guess... Actually, no. Everyone can choose their own number of spaces-per-tab and it'll look right, as long as everyone uses a monospace font. You never tried that with tabs plus additional spaces to line up e.g. arguments that are broken across lines, right? You must not understand what they're talking about, because it works fine. The example is this: \ class Foo: \tdef Function(): \t\tAnotherFunctionThatTakesManyArguments(arg1, \t\t arg2, \t\t arg3) And there are a number of environments where you can't change the length of a tab like email or terminals where code will be displayed from time to time for example as diffs from a version control system. That's the point of doing it in this way with tabs to specify indent level and spaces to specify tabular alignment. Me, I could never get emacs's python stuff to work suitably so I just use a Dead Simple Editor (SciTE) in which I use tabs exclusively; continuation indents are always exactly one additional tab over the thing that's being continued. Perhaps interestingly, for development I have my editor set to show tabs as fairly short, but my diff program shows them as eight characters. I find that makes indentation changes easier to spot in the diffs. -tom! -- -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
In message [EMAIL PROTECTED], Tom Plunket wrote: Perhaps interestingly, for development I have my editor set to show tabs as fairly short, but my diff program shows them as eight characters. I find that makes indentation changes easier to spot in the diffs. I think there should be a single environment variable, perhaps called TABS, which specifies the tab settings across all relevant tools that work with text, including less and diff. So for example setting this as export TABS=4 will cause these tools to treat tabs as equivalent to stepping to the next multiple of four columns from the start of the line. -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Paul McNett [EMAIL PROTECTED] typed Steven D'Aprano wrote: But I think we all agree that mixing tabs and spaces is A Very Bad Thing. I like mixing tabs and spaces, actually. Tabs for indentation, and additional spaces to make the code look pretty. Somebody please tell me why this is bad and I'll stop. class Apple(object): def contrived_example_function(self, argument1, argument2, argument3, argument4): print hello, world Apparently, emacs in python mode follows this convention, too. That doesn't seem like a standard settings to me. I can't remember changing the indentation settings for python, nonetheless my gnu emacs uses four spaces for indentation. Placing wrapped lines into ordered columns is done by inserting additional spaces. This all happens automatically; you never need to insert spaces manually... I like it because I get the best of both worlds: the only thing against using tabs-only-indentation is that wrapping long lines can be quite ugly, while space-only-indentation allows for beautifying it somewhat by lining up the columns to match. Did you try to open your code files with another editor, which has a different length for tabulator chars? It would look quite ugly, I guess... -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Sebastian 'lunar' Wiesner wrote: Paul McNett [EMAIL PROTECTED] typed Steven D'Aprano wrote: But I think we all agree that mixing tabs and spaces is A Very Bad Thing. I like mixing tabs and spaces, actually. Tabs for indentation, and additional spaces to make the code look pretty. Somebody please tell me why this is bad and I'll stop. class Apple(object): def contrived_example_function(self, argument1, argument2, argument3, argument4): print hello, world Apparently, emacs in python mode follows this convention, too. That doesn't seem like a standard settings to me. I can't remember changing the indentation settings for python, nonetheless my gnu emacs uses four spaces for indentation. Placing wrapped lines into ordered columns is done by inserting additional spaces. This all happens automatically; you never need to insert spaces manually... I never tried emacs, but somebody once told me that if you have set indentation-by-tab, it will indent with tabs but insert additional spaces in wrapped lines to look pretty. I like it because I get the best of both worlds: the only thing against using tabs-only-indentation is that wrapping long lines can be quite ugly, while space-only-indentation allows for beautifying it somewhat by lining up the columns to match. Did you try to open your code files with another editor, which has a different length for tabulator chars? It would look quite ugly, I guess... Actually, no. Everyone can choose their own number of spaces-per-tab and it'll look right, as long as everyone uses a monospace font. -- pkm ~ http://paulmcnett.com -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Steven D'Aprano wrote: But I think we all agree that mixing tabs and spaces is A Very Bad Thing. I like mixing tabs and spaces, actually. Tabs for indentation, and additional spaces to make the code look pretty. Somebody please tell me why this is bad and I'll stop. class Apple(object): def contrived_example_function(self, argument1, argument2, argument3, argument4): print hello, world Apparently, emacs in python mode follows this convention, too. I like it because I get the best of both worlds: the only thing against using tabs-only-indentation is that wrapping long lines can be quite ugly, while space-only-indentation allows for beautifying it somewhat by lining up the columns to match. Tabs+spaces allows the lining up with spaces to be explicitly separate from indentation. -- pkm ~ http://paulmcnett.com -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Ben [EMAIL PROTECTED] wrote: Great - that worked.Thanks! Is that a general method in linux you can always use to redirect standard output to a file? Works in Windows, too. -- Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Erik Johnson ej at somewhere.com typed Ben Finney [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sebastian 'lunar' Wiesner [EMAIL PROTECTED] writes: Just a tip for you: In python you never use tabs for indentation. For some value of you. The python style guide [1] recommends four spaces per indentation level. [1] http://www.python.org/dev/peps/pep-0008/ It's not quite absolute on the topic: For new projects, spaces-only are strongly recommended over tabs. Even if were, read the Introduction. This is a coding standard intended to apply to code which is going to checked in as part of the core python build, not all Python! It's probably a pretty good standard to be following in general, but come on... It is, and especially the problems with tabs shows you, why it is good practice to follow the standard in your own code, too... -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
On Thu, 28 Dec 2006 09:26:28 +0100, Sebastian 'lunar' Wiesner wrote: It is, and especially the problems with tabs shows you, why it is good practice to follow the standard in your own code, too... I don't know what problems with tabs you are talking about. I never have problems with tabs. *Other people* who choose to use software that doesn't understand tabs have problems. I've spent a lot of time reading both sides of the tabs versus spaces argument, and I haven't found anything yet that explains why tabs are, in and of themselves, bad. -- Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Steven D'Aprano wrote: On Thu, 28 Dec 2006 09:26:28 +0100, Sebastian 'lunar' Wiesner wrote: It is, and especially the problems with tabs shows you, why it is good practice to follow the standard in your own code, too... I don't know what problems with tabs you are talking about. I never have problems with tabs. *Other people* who choose to use software that doesn't understand tabs have problems. I've spent a lot of time reading both sides of the tabs versus spaces argument, and I haven't found anything yet that explains why tabs are, in and of themselves, bad. You gave the reason in your post : because other people who are using software that doesn't understand tabs as YOU expect them to have problems with your code. Tabs aren't a problem at all as long as nobody else than you edit your code. -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Steven D'Aprano [EMAIL PROTECTED] typed On Thu, 28 Dec 2006 09:26:28 +0100, Sebastian 'lunar' Wiesner wrote: It is, and especially the problems with tabs shows you, why it is good practice to follow the standard in your own code, too... I don't know what problems with tabs you are talking about. I never have problems with tabs. *Other people* who choose to use software that doesn't understand tabs have problems. Mmmh, maybe you never worked together with a team of other programmers or have such a high position, that you can afford to ignore complaints of your co-workers... -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Sebastian 'lunar' Wiesner schrieb: Ben [EMAIL PROTECTED] typed I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. Just a tip for you: In python you never use tabs for indentation. The python style guide [1] recommends four spaces per indentation level. [1] http://www.python.org/dev/peps/pep-0008/ I like using tabs. And the style guide doesn't give a reason why one shouldn't and neither does the thread http://www.python.org/search/hypermail/python-1994q2/0198.html in the archive. So what's the point in typing four spaces for indentation instead of one tab? -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Christophe Cavalaria schrieb: Steven D'Aprano wrote: You gave the reason in your post : because other people who are using software that doesn't understand tabs as YOU expect them to have problems with your code. Tabs aren't a problem at all as long as nobody else than you edit your code. Sorry, but that's a silly argument. With the same argument we should stop using python alltogether since the usual MBA will understand nothing but VBA. -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Felix Benner wrote: Christophe Cavalaria schrieb: Steven D'Aprano wrote: You gave the reason in your post : because other people who are using software that doesn't understand tabs as YOU expect them to have problems with your code. Tabs aren't a problem at all as long as nobody else than you edit your code. Sorry, but that's a silly argument. With the same argument we should stop using python alltogether since the usual MBA will understand nothing but VBA. No it isn't. If you have to work with some MBA that understands nothing but VBA, why the hell are you writing Python code in the first place? -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Felix Benner [EMAIL PROTECTED] wrote: So what's the point in typing four spaces for indentation instead of one tab? So long as you always use only tabs there is no problem. So long as you only use spaces there is no problem. If you mix tabs and spaces you can introduce bugs. In particular, some people set their editor up to expand 1 tab to the next multiple of 4 spaces on their screen, but the usual convention for tabs (and one that Python follows internally) is that tabs expand to the next multiple of 8 spaces. Usually when you mix spaces and tabs what you get either works the way you intend, or it generates a syntax error. Once however when this recurring question popped up I did a search through a load of Python files and actually found once instance of some code which had been released and ran whether tabs were expanded to 4 or 8 space boundaries. Reading that code it was apparent that it had been written using 4 space tabs on the screen, but that when it ran it did something different than had been intended. So, given that mixing tabs and spaces is deadly choose one or the other and stick to it. If you intend to work with other people then choose the same convention as they use. If you are never going to work with others then use whichever scheme makes you most comfortable. Be careful as not all open source projects use the same convention: in previous discussions on this newsgroup there were people arguing quite strongly for using the tab convention. A straw poll indicated that there was 1 open source project with 3 developers using tabs, and all other open source projects use spaces only as the stated (but not always strictly enforced) convention. Your experience may of course differ. Of course nobody in their right minds actually types 4 spaces for indentation: they use an editor where if the automatic indentation isn't correct then hitting the tab key inserts the correct number of spaces (and with luck where hitting the backspace key deletes back to the previous tabstop). -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
In [EMAIL PROTECTED], Felix Benner wrote: I like using tabs. And the style guide doesn't give a reason why one shouldn't and neither does the thread http://www.python.org/search/hypermail/python-1994q2/0198.html in the archive. So what's the point in typing four spaces for indentation instead of one tab? You don't need to type four spaces. Every decent editor lets you use the Tab key and inserts the proper amount of spaces for you. Same for Backspace removing the proper amount of spaces to get to the previous tab stop. There are plenty of reasons from both sides. This is a religious issue, so please search the net for answers and don't start another flam^H^H^H^Hdebate here. Please! Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
On 2006-12-28, Steven D'Aprano [EMAIL PROTECTED] wrote: I've spent a lot of time reading both sides of the tabs versus spaces argument, and I haven't found anything yet that explains why tabs are, in and of themselves, bad. They aren't. Using tabs isn't bad. Using both tabs and spaces is bad, so the people managing the official Python source tree picked one. Maybe they've got reasons for liking spaces over tabs. Maybe they just flipped a coin. It doens't matter. What matters is picking one and sticking with it. -- Grant Edwards grante Yow! YOU'D cry too if it at happened to YOU!! visi.com -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
On 2006-12-28, Felix Benner [EMAIL PROTECTED] wrote: I like using tabs. And the style guide doesn't give a reason why one shouldn't and neither does the thread http://www.python.org/search/hypermail/python-1994q2/0198.html in the archive. So what's the point in typing four spaces for indentation instead of one tab? So that the whole Python source tree is consistent. -- Grant Edwards grante Yow! What I want to find at out is -- do parrots know visi.commuch about Astro-Turf? -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] typed In [EMAIL PROTECTED], Felix Benner wrote: I like using tabs. And the style guide doesn't give a reason why one shouldn't and neither does the thread http://www.python.org/search/hypermail/python-1994q2/0198.html in the archive. This is a religious issue It is, because god itself used four spaces for indentation when he wrote his world project in seven days ;) -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Steven D'Aprano wrote: I don't know what problems with tabs you are talking about. I never have problems with tabs. *Other people* who choose to use software that doesn't understand tabs have problems. I've spent a lot of time reading both sides of the tabs versus spaces argument, and I haven't found anything yet that explains why tabs are, in and of themselves, bad. Indeed. In fact, I came to the conclusion several years ago that tabs are in better for formatting code because then different people on the team can have their preferred tabstop width, be it 8, 4, or 2 spaces. Ironically, it has always seemed to me then that tabs are superior for python editing, since mixing tabs and spaces in an environment like this means that stuff won't run, whereas in C it'll still compile even if the code looks awful. -tom! -- -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
I've found the unexpand command, which seems to do the trick. However, it outputs to standard output, and I haven't worked out yet how to capture that output to a file... Ben Ben wrote: Hi, I have a python script on a unix system that runs fine. I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. I now want to run them on the same system, actually in the same script by combining bits and pieces. But whatever I try my windows tabs get converted to spaces when I transfer it to the unix system and the interpreter complains that the indentation style is not consistent throughout the file. Short of going through 350 lines of code and manually replacing spaces with tabs what an I do? I'm thinking there surely must be a simple solution I have missed here! Cheers, Ben -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
On 2006-12-27, Ben [EMAIL PROTECTED] wrote: I've found the unexpand command, which seems to do the trick. However, it outputs to standard output, and I haven't worked out yet how to capture that output to a file... unexpand file1 file2 -- Grant Edwards grante Yow! Hey, LOOK!! A pair of at SIZE 9 CAPRI PANTS!! They visi.comprobably belong to SAMMY DAVIS, JR.!! -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Great - that worked.Thanks! Is that a general method in linux you can always use to redirect standard output to a file? Cheers, Ben Grant Edwards wrote: On 2006-12-27, Ben [EMAIL PROTECTED] wrote: I've found the unexpand command, which seems to do the trick. However, it outputs to standard output, and I haven't worked out yet how to capture that output to a file... unexpand file1 file2 -- Grant Edwards grante Yow! Hey, LOOK!! A pair of at SIZE 9 CAPRI PANTS!! They visi.comprobably belong to SAMMY DAVIS, JR.!! -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
On 2006-12-27, Ben [EMAIL PROTECTED] wrote: I've found the unexpand command, which seems to do the trick. However, it outputs to standard output, and I haven't worked out yet how to capture that output to a file... unexpand file1 file2 Great - that worked.Thanks! Is that a general method in linux you can always use to redirect standard output to a file? Yup. The operator redirects stdin, the operator redirects stdout. 2 redirects stderr. -- Grant Edwards grante Yow! Let's go to CHURCH! at visi.com -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Ben [EMAIL PROTECTED] typed I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. Just a tip for you: In python you never use tabs for indentation. The python style guide [1] recommends four spaces per indentation level. [1] http://www.python.org/dev/peps/pep-0008/ -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Sebastian 'lunar' Wiesner [EMAIL PROTECTED] writes: Just a tip for you: In python you never use tabs for indentation. For some value of you. The python style guide [1] recommends four spaces per indentation level. [1] http://www.python.org/dev/peps/pep-0008/ It's not quite absolute on the topic: For new projects, spaces-only are strongly recommended over tabs. -- \ I filled my humidifier with wax. Now my room is all shiny. | `\ -- Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Ben schreef: I have a python script on a unix system that runs fine. I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. I now want to run them on the same system, actually in the same script by combining bits and pieces. But whatever I try my windows tabs get converted to spaces when I transfer it to the unix system and the interpreter complains that the indentation style is not consistant throughout the file. Short of going through 350 lines of code and manually replacing spaces with tabs what an I do? I'm thinking there surely must be a simple solution I have missed here! How do you transfer the files or their contents from Windows to Unix and vice versa? Whatever means you use shouldn't change the file contents, except possibly conversion of line endings. What editors do you use on both systems? Maybe it's just the way one of your editors is configured? Are you sure there are tabs in the files, or does one of your editors automatically convert them to spaces? Maybe it's not a bad idea to view your Windows files with a Windows-based hex editor to make sure the indentation is really made up of tabs. BTW I'm a proponent of spaces instead of tabs, but indentation by tabs only (i.e. not a mixture of tabs and spaces) is an acceptable solution too and it should work. -- If I have been able to see further, it was only because I stood on the shoulders of giants. -- Isaac Newton Roel Schroeven -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
At Wednesday 27/12/2006 20:09, Ben Finney wrote: The python style guide [1] recommends four spaces per indentation level. [1] http://www.python.org/dev/peps/pep-0008/ It's not quite absolute on the topic: For new projects, spaces-only are strongly recommended over tabs. Of course you can do it anyway you like, but you should have a *strong* reason for not following a *strong* recommendation. (Just a note, you can use untabify.py (inside the Tools dir) to convert tabs to spaces, instead of unexpand) -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
Ben Finney [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sebastian 'lunar' Wiesner [EMAIL PROTECTED] writes: Just a tip for you: In python you never use tabs for indentation. For some value of you. The python style guide [1] recommends four spaces per indentation level. [1] http://www.python.org/dev/peps/pep-0008/ It's not quite absolute on the topic: For new projects, spaces-only are strongly recommended over tabs. Even if were, read the Introduction. This is a coding standard intended to apply to code which is going to checked in as part of the core python build, not all Python! It's probably a pretty good standard to be following in general, but come on... If Guido really wanted this enforced across the board he could simply call anything that doesn't meet this standard to the letter a SyntaxError and just stop there. For example, the standard states: - Imports should usually be on separate lines, e.g.: Yes: import os import sys No: import sys, os import sys, os Traceback (most recent call last): File stdin, line 1, in ? ImportError: Sorry, only one module per import line! I'm sure that's not Guido's intention. ;) -ej -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS, UNIX and tabs
On Wed, 27 Dec 2006 20:15:33 +0100, Sebastian 'lunar' Wiesner wrote: Ben [EMAIL PROTECTED] typed I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. Just a tip for you: In python you never use tabs for indentation. The python style guide [1] recommends four spaces per indentation level. [1] http://www.python.org/dev/peps/pep-0008/ [obligatory pot-shot in the never-ending spaces versus tabs war] In Python, I frequently use tabs for indentation, and I never have any trouble *except* when posting code to Usenet, where other people's news readers can't cope with tabs. But I think we all agree that mixing tabs and spaces is A Very Bad Thing. -- Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list