Re: Multiline parsing of python compiler demistification needed

2016-06-22 Thread Lawrence D’Oliveiro
On Thursday, June 16, 2016 at 8:34:46 PM UTC+12, Yubin Ruan wrote: > print "A test case" + \ >"str_1[%s] " + \ >"str_2[%s] " % (str_1, str_2) Try this: print \ ( "A test case" "str_1[%s] " "str_2[%s] " % (str_1, str_2) ) Python takes this n

Re: Multiline parsing of python compiler demistification needed

2016-06-16 Thread Frank Millman
"Yubin Ruan" wrote in message news:930753e3-4c9c-45e9-9117-d340c033a...@googlegroups.com... Hi, everyone, I have some problem understand the rule which the python compiler use to parsing the multiline string. Consider this snippet: str_1 = "foo" str_2 = "bar" print "A test case" + \

Re: Multiline parsing of python compiler demistification needed

2016-06-16 Thread Jussi Piitulainen
Yubin Ruan writes: > Hi, everyone, I have some problem understand the rule which the python > compiler use to parsing the multiline string. > > Consider this snippet: > > str_1 = "foo" > str_2 = "bar" > > print "A test case" + \ >"str_1[%s] " + \ >"str_2[%s] " % (str_1, str_2) > >

Re: Multiline parsing of python compiler demistification needed

2016-06-16 Thread Peter Otten
Yubin Ruan wrote: > Hi, everyone, I have some problem understand the rule which the python > compiler use to parsing the multiline string. > > Consider this snippet: > > str_1 = "foo" > str_2 = "bar" > > print "A test case" + \ >"str_1[%s] " + \ >"str_2[%s] " % (str_1, str_2) >

Re: Multiline regex

2010-07-21 Thread Steven D'Aprano
On Wed, 21 Jul 2010 10:06:14 -0500, Brandon Harris wrote: > what do you mean by slurp the entire file? I'm trying to use regular > expressions because line by line parsing will be too slow. And example > file would have somewhere in the realm of 6 million lines of code. And you think trying to r

Re: Multiline regex

2010-07-21 Thread Jeremy Sanders
Brandon Harris wrote: > I'm trying to read in and parse an ascii type file that contains > information that can span several lines. > Example: What about something like this (you need re.MULTILINE): In [16]: re.findall('^([^ ].*\n([ ].*\n)+)', a, re.MULTILINE) Out[16]: [('createNode animCurveTU

RE: Multiline regex

2010-07-21 Thread Andreas Tawn
>>> I could make it that simple, but that is also incredibly slow and on >>> a file with several million lines, it takes somewhere in the league of >>> half an hour to grab all the data. I need this to grab data from >>> many many file and return the data quickly. >>> >>> Brandon L. Harris >>> >> T

Re: Multiline regex

2010-07-21 Thread Brandon Harris
Could it be that there isn't just that type of data in the file? there are many different types, that is just one that I'm trying to grab. Brandon L. Harris Andreas Tawn wrote: I could make it that simple, but that is also incredibly slow and on a file with several million lines, it takes som

RE: RE: Multiline regex

2010-07-21 Thread Andreas Tawn
> I could make it that simple, but that is also incredibly slow and on a > file with several million lines, it takes somewhere in the league of > half an hour to grab all the data. I need this to grab data from many > many file and return the data quickly. > > Brandon L. Harris That's surprising.

Re: RE: Multiline regex

2010-07-21 Thread Brandon Harris
I could make it that simple, but that is also incredibly slow and on a file with several million lines, it takes somewhere in the league of half an hour to grab all the data. I need this to grab data from many many file and return the data quickly. Brandon L. Harris Andreas Tawn wrote: I'm

Re: Multiline regex

2010-07-21 Thread Peter Otten
Brandon Harris wrote: > I'm trying to read in and parse an ascii type file that contains > information that can span several lines. > Example: > > createNode animCurveTU -n "test:master_globalSmooth"; > setAttr ".tan" 9; > setAttr -s 4 ".ktv[0:3]" 101 0 163 0 169 0 201 0; > setAttr -

RE: Multiline regex

2010-07-21 Thread Andreas Tawn
> I'm trying to read in and parse an ascii type file that contains > information that can span several lines. > Example: > > createNode animCurveTU -n "test:master_globalSmooth"; > setAttr ".tan" 9; > setAttr -s 4 ".ktv[0:3]" 101 0 163 0 169 0 201 0; > setAttr -s 4 ".kit[3]" 10; >

Re: Multiline regex

2010-07-21 Thread Brandon Harris
At the moment I'm trying to stick with built in python modules to create tools for a much larger pipeline on multiple OSes. Brandon L. Harris Eknath Venkataramani wrote: On Wed, Jul 21, 2010 at 8:12 PM, Brandon Harris mailto:brandon.har...@reelfx.com>> wrote: I'm trying to read in an

Re: Multiline regex

2010-07-21 Thread Eknath Venkataramani
On Wed, Jul 21, 2010 at 8:12 PM, Brandon Harris wrote: > I'm trying to read in and parse an ascii type file that contains > information that can span several lines. > Do you have to use only regex? If not, I'd certainly suggest 'pyparsing'. It's a pleasure to use and very easy on the eye too, if

Re: Multiline regex

2010-07-21 Thread Brandon Harris
what do you mean by slurp the entire file? I'm trying to use regular expressions because line by line parsing will be too slow. And example file would have somewhere in the realm of 6 million lines of code. Brandon L. Harris Rodrick Brown wrote: Slurp the entire file into a string and pick o

Re: Multiline regex

2010-07-21 Thread Rodrick Brown
Slurp the entire file into a string and pick out the fields you need. Sent from my iPhone 4. On Jul 21, 2010, at 10:42 AM, Brandon Harris wrote: > I'm trying to read in and parse an ascii type file that contains information > that can span several lines. > Example: > > createNode animCurveTU

Re: RE multiline

2008-11-30 Thread Diez B. Roggisch
Guy Doune schrieb: Hi, I try to figure out what gonna be the equivalent of : (.*?) For the same purpose on multiline basis. I would like completed the variable part of elements that I searching for. Example : align="center"> Is the begining of the variable element that I wanna completed..

RE multiline

2008-11-30 Thread Guy Doune
Hi, I try to figure out what gonna be the equivalent of : (.*?) For the same purpose on multiline basis. I would like completed the variable part of elements that I searching for. Example : align="center"> Is the begining of the variable element that I wanna completed... Is the end of t

Re: Multiline text in XML file

2008-08-03 Thread Pete Kirkham
http://www.w3.org/TR/REC-xml/#sec-white-space is relevant, as is the following section on handling carriage returns. Don't mix C escapes "\n" and XML markup - there really is is no point, and it reduces the portability of the XML. XML lets you put carriage returns in without excapes into text, and

Re: Multiline text in XML file

2008-08-02 Thread Stefan Behnel
King wrote: > Is there any other way to define multiline text in a XML file: > > > Yes, without the CDATA, for example. XML doesn't treat line ending characters any different from other characters. I have no idea what you are trying to achieve since you didn't tell us (and this newsgroup seems

Re: Multiline text in XML file

2008-08-02 Thread Zoltán Nagy
King wrote: > Is there any other way to define multiline text in a XML file: > > > Unless someone has to edit the XML manually (which is bad anyway): first line\nsecond line -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiline CSV export to Excel produces unrecognized characters?

2008-03-24 Thread felciano
> > Any chance you are doing this on Windows and Excel doesn't like the > return+linefeed line endings that Windows produces when writing files in > text mode? Try 'wb' as mode for the output file. > > Ciao, > Marc 'BlackJack' Rintsch > Fixed! Can't believe I missed that... Thank you for

Re: Multiline CSV export to Excel produces unrecognized characters?

2008-03-24 Thread Marc 'BlackJack' Rintsch
On Sun, 23 Mar 2008 23:30:11 -0700, felciano wrote: > The following reproduces the problem in python 2.5: > > import csv > row = [1,"hello","this is\na multiline\ntext field"] > writer = csv.writer(open("test.tsv", "w"), dialect="excel-tab", > quotechar='"') > writer.writerow(row) > > When openi

Re: Multiline lamba implementation in python.

2007-06-15 Thread Josh Gilbert
On Wednesday 13 June 2007 4:04 am, Duncan Booth wrote: > "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > But you already have "multiline" lambdas right now in that sense, no > > need to add anything. I think you were talking about lambdas *with* > > statements inside. > > > > bin = lambda x:((

Re: Multiline lamba implementation in python.

2007-06-13 Thread Duncan Booth
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > But you already have "multiline" lambdas right now in that sense, no > need to add anything. I think you were talking about lambdas *with* > statements inside. > > bin = lambda x:((x&8 and '*' or '_') + > (x&4 and '*' or '_') + >

Re: Multiline lamba implementation in python.

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 20:48:41 -0300, Josh Gilbert <[EMAIL PROTECTED]> escribió: > Guido doesn't want multiline lambdas, that's a really good reason not to > add > them. They are, on the other hand, very useful at times. Even if he did > add > multiline lambdas it's not certain that he would a

Re: Multiline lamba implementation in python.

2007-06-12 Thread Kay Schluehr
On 12 Jun., 20:17, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 12, 11:36 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On 12 Jun., 16:54, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On 12 Jun., 14:57, Facundo

Re: Multiline lamba implementation in python.

2007-06-12 Thread Steve Howell
--- Josh Gilbert <[EMAIL PROTECTED]> wrote: > > I know that the standard Python response is that you > might as well define a > function, indeed, the name might provide useful > documentation. In reality, > however, the vast majority of my anonymous functions > are callbacks (tends to > lead to na

Re: Multiline lamba implementation in python.

2007-06-12 Thread Josh Gilbert
On 6/12/07, Facundo Batista <[EMAIL PROTECTED]> wrote: Josh Gilbert wrote: > I don't expect multiline lambdas to be added to Python. I'm not so sure that > that's a bad thing. Regardless, isn't it possible to write your own Yes, it is a bad thing. Why? Because it would another way to do somet

Re: Multiline lamba implementation in python.

2007-06-12 Thread George Sakkis
On Jun 12, 11:36 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Jun., 16:54, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > On 12 Jun., 14:57, Facundo Batista <[EMAIL PROTECTED]> wrote: > > > > > Remember that the *only*

Re: Multiline lamba implementation in python.

2007-06-12 Thread Kay Schluehr
On 12 Jun., 16:54, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > On 12 Jun., 14:57, Facundo Batista <[EMAIL PROTECTED]> wrote: > > > > Remember that the *only* difference between the two functions is that > > > one is anonymous, and fo

Re: Multiline lamba implementation in python.

2007-06-12 Thread George Sakkis
On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Jun., 14:57, Facundo Batista <[EMAIL PROTECTED]> wrote: > > > Remember that the *only* difference between the two functions is that > > one is anonymous, and for other you have to came up with a name (name > > that if is well thou

Re: Multiline lamba implementation in python.

2007-06-12 Thread Kay Schluehr
On 12 Jun., 14:57, Facundo Batista <[EMAIL PROTECTED]> wrote: > Remember that the *only* difference between the two functions is that > one is anonymous, and for other you have to came up with a name (name > that if is well thought, actually adds readibility to your code). The difference is that

Re: Multiline lamba implementation in python.

2007-06-12 Thread Facundo Batista
Josh Gilbert wrote: > I don't expect multiline lambdas to be added to Python. I'm not so sure that > that's a bad thing. Regardless, isn't it possible to write your own Yes, it is a bad thing. Why? Because it would another way to do something you can do in other way. The *only* big value of lam

Re: Multiline lamba implementation in python.

2007-06-12 Thread Carsten Haese
On Tue, 12 Jun 2007 02:29:31 -0700, exhuma.twn wrote > lambdas are to be removed in Py3k IIRC. No. From http://www.python.org/dev/peps/pep-3099/, "At one point lambda was slated for removal in Python 3000. Unfortunately no one was able to come up with a better way of providing anonymous functions.

Re: Multiline lamba implementation in python.

2007-06-12 Thread exhuma.twn
On Jun 12, 5:57 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 12 Jun 2007 00:02:37 -0300, Josh Gilbert > <[EMAIL PROTECTED]> escribió: > > > I don't expect multiline lambdas to be added to Python. I'm not so sure > > that > > that's a bad thing. Regardless, isn't it possible to write

Re: Multiline lamba implementation in python.

2007-06-11 Thread Gabriel Genellina
En Tue, 12 Jun 2007 00:02:37 -0300, Josh Gilbert <[EMAIL PROTECTED]> escribió: > I don't expect multiline lambdas to be added to Python. I'm not so sure > that > that's a bad thing. Regardless, isn't it possible to write your own > implementation of multiline lambdas as functions? Wouldn't tha

Re: multiline regular expression (replace)

2007-05-30 Thread Zdenek Maxa
Hi, Thanks a lot for useful hints to all of you who replied to my question. I could easily do now what I wanted. Cheers, Zdenek Holger Berger wrote: > Hi, > > yes: > > import re > > a=""" > I Am > Multiline > but short anyhow""" > > b="(I[\s\S]*line)" > > print re.search(b, a,re.MULTILINE).gro

Re: multiline regular expression (replace)

2007-05-29 Thread Holger Berger
Hi, yes: import re a=""" I Am Multiline but short anyhow""" b="(I[\s\S]*line)" print re.search(b, a,re.MULTILINE).group(1) gives I Am Multiline Be aware that . matches NO newlines!!! May be this caused your problems? regards Holger Zdenek Maxa wrote: > [EMAIL PROTECTED] wrote:

Re: multiline regular expression (replace)

2007-05-29 Thread Gerard Flanagan
On May 29, 11:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote: > Hi all, > > I would like to perform regular expression replace (e.g. removing > everything from within tags in a XML file) with multiple-line pattern. > How can I do this? > > where = open("filename").read() > multilinePattern = "^

Re: multiline regular expression (replace)

2007-05-29 Thread vbr
> Od: Zdenek Maxa <[EMAIL PROTECTED]> > Předmět: Re: multiline regular expression (replace) > Datum: 29.5.2007 13:46:32 > > [EMAIL PROTECTED] wrote: > > On May 29, 2:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote: > >

Re: multiline regular expression (replace)

2007-05-29 Thread Steve Holden
Zdenek Maxa wrote: > [EMAIL PROTECTED] wrote: >> On May 29, 2:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote: >> >>> Hi all, >>> >>> I would like to perform regular expression replace (e.g. removing >>> everything from within tags in a XML file) with multiple-line pattern. >>> How can I do this? >

Re: multiline regular expression (replace)

2007-05-29 Thread Zdenek Maxa
[EMAIL PROTECTED] wrote: > On May 29, 2:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote: > >> Hi all, >> >> I would like to perform regular expression replace (e.g. removing >> everything from within tags in a XML file) with multiple-line pattern. >> How can I do this? >> >> where = open("filename"

Re: multiline regular expression (replace)

2007-05-29 Thread half . italian
On May 29, 2:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote: > Hi all, > > I would like to perform regular expression replace (e.g. removing > everything from within tags in a XML file) with multiple-line pattern. > How can I do this? > > where = open("filename").read() > multilinePattern = "^ <

Re: Multiline code - trailing slash usage

2007-03-15 Thread Ben Finney
"abcd" <[EMAIL PROTECTED]> writes: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" You can either do that, or you can use parentheses: x = ( "foo" + "bar" ) Note

Re: Multiline code - trailing slash usage

2007-03-15 Thread Duncan Booth
Steve Holden <[EMAIL PROTECTED]> wrote: > x = "hello world, this is my multiline " \ > "string" > > and this would have saved you a run-time string concatenation :) or use parentheses for an alternative which doesn't need the backslash: x = ("hello world, this is my multiline "

Re: Multiline code - trailing slash usage

2007-03-15 Thread Christoph Haas
On Thursday 15 March 2007 15:57, abcd wrote: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" Needed. Although you can omit the "+". > x = {'name' : \ > 'bob'} Not needed b

Re: Multiline code - trailing slash usage

2007-03-15 Thread Bruno Desthuilliers
abcd a écrit : > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" Here you don't need the + > x = {'name' : \ > 'bob'} And here you don't need the antislash > Do I need to

Re: Multiline code - trailing slash usage

2007-03-15 Thread Steven Bethard
abcd wrote: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" Yes. > > x = {'name' : \ > 'bob'} No. You don't need trailing slashes whenever there's a pair of {}, [] or

Re: Multiline code - trailing slash usage

2007-03-15 Thread Larry Bates
abcd wrote: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" > > x = {'name' : \ > 'bob'} > > Do I need to use the "\" in the above examples? When do i need to use > it?

Re: Multiline code - trailing slash usage

2007-03-15 Thread Steve Holden
abcd wrote: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" > > x = {'name' : \ > 'bob'} > > Do I need to use the "\" in the above examples? When do i need to use > it?

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread Dave Hansen
On Wed, 10 May 2006 15:50:38 GMT in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: >Dave Hansen wrote: > > print textwrap.dedent(s).strip().replace('\n',' ') >> this is a multiline triple-quted string with indentation for nicer >> code formatting > >But I have some newlines that are

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread John Salerno
Dave Hansen wrote: print textwrap.dedent(s).strip().replace('\n',' ') > this is a multiline triple-quted string with indentation for nicer > code formatting But I have some newlines that are already embedded in the string, and I wouldn't want those replaced. -- http://mail.python.org/mailm

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread Dave Hansen
On Wed, 10 May 2006 13:56:52 GMT in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: >bruno at modulix wrote: > >> Why not trying by yourself ?-) > >Doh! I always forget I can do this! :) > > >> Mmm. Not good. Let's try again: > print textwrap.dedent(s).strip() >> this is a multiline

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread John Salerno
bruno at modulix wrote: > Why not trying by yourself ?-) Doh! I always forget I can do this! :) > Mmm. Not good. Let's try again: print textwrap.dedent(s).strip() > this is a multiline > triple-quted string with > indentation for nicer code formatting > > Well, seems like we're done. Abou

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread bruno at modulix
John Salerno wrote: > Gary Herron wrote: > >> Gary John Salerno wrote: >> >>> How do you make a single string span multiple lines, but also allow >>> yourself to indent the second (third, etc.) lines so that it lines up >>> where you want it, without causing the newlines and tabs or spaces to >>>

Re: multiline strings and proper indentation/alignment

2006-05-09 Thread John Salerno
Gary Herron wrote: > Gary John Salerno wrote: > >> How do you make a single string span multiple lines, but also allow >> yourself to indent the second (third, etc.) lines so that it lines up >> where you want it, without causing the newlines and tabs or spaces to be >> added to the string as w

Re: multiline strings and proper indentation/alignment

2006-05-09 Thread Gary Herron
Gary John Salerno wrote: >How do you make a single string span multiple lines, but also allow >yourself to indent the second (third, etc.) lines so that it lines up >where you want it, without causing the newlines and tabs or spaces to be >added to the string as well? > >Example (pretend this i

Re: multiline strings and proper indentation/alignment

2006-05-09 Thread John Salerno
Scott David Daniels wrote: > John Salerno wrote: >> How do you make a single string span multiple lines, but also allow >> yourself to indent the second ... without causing the newlines and >> tabs or spaces to be added to the string as well? > > >> self.DTD = '''>"http://www.w3.org/

Re: multiline strings and proper indentation/alignment

2006-05-09 Thread Scott David Daniels
John Salerno wrote: > How do you make a single string span multiple lines, but also allow > yourself to indent the second ... without causing the newlines and > tabs or spaces to be added to the string as well? > > self.DTD = '''"http://www.w3.org/TR/html4/strict.dtd";>\n\n''' > > .

Re: multiline strings and proper indentation/alignment

2006-05-09 Thread Christoph Haas
On Tue, May 09, 2006 at 05:38:52PM +, John Salerno wrote: > How do you make a single string span multiple lines, but also allow > yourself to indent the second (third, etc.) lines so that it lines up > where you want it, without causing the newlines and tabs or spaces to be > added to the st

Re: multiline comments

2006-04-20 Thread Edward Elliott
Sion Arrowsmith wrote: > It appears to me that our fundamental difference is that you see value > in long-term preservation of sections of commented-out code without > any kind of real comment as to what's going on, whereas I consider > this to be appallingly bad practice. Then you're reading too

Re: multiline comments

2006-04-20 Thread Sion Arrowsmith
Edward Elliott <[EMAIL PROTECTED]> wrote: >Sion Arrowsmith wrote: >> Really? Under what circumstances is it easier to see what's going on >> with start/end comments than with comment-to-end-of-line? >Off the top of my head: > [ ... ] It appears to me that our fundamental difference is that you se

Re: multiline comments

2006-04-20 Thread Ben Finney
"OKB (not okblacke)" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > If your revision control system is so inconvenient to use that > > you'd rather have large blocks of commented-out code, it's time to > > start using a better RCS -- perhaps a distributed one, so you can > > commit to your ow

Re: multiline comments

2006-04-20 Thread OKB (not okblacke)
Ben Finney wrote: > Indeed. Using revision control means never needing to comment out > blocks of code. > > If your revision control system is so inconvenient to use that you'd > rather have large blocks of commented-out code, it's time to start > using a better RCS -- perhaps a distributed one,

Re: multiline comments

2006-04-19 Thread Jorge Godoy
rx wrote: > Still a little strange to newcomers that there are three ways to do the > same and that you should be carefull to use the right '''/""" inside the > comment else the comment will not work for some reason. > > #comment > > ''' > comment > ''' > > """ > comment > """ Please, note tha

Re: multiline comments

2006-04-19 Thread rx
"Jorge Godoy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > rx wrote: > >> I don't understand the problem - why should comments (and I hope you >> believe there should be a one line comment at least) be restricted to one >> line. It doesn't work that way for if, while, for. > > It

Re: multiline comments

2006-04-19 Thread rx
> > Of course! You should have used """ since you already used ''' in your > triple-quoted text. But I'm just repeating what I already said (and kept > above so that you can see it again). > > -- > Jorge Godoy <[EMAIL PROTECTED]> > Sorry - I should have read more carefully. I like the ide

Re: multiline comments

2006-04-19 Thread Jorge Godoy
rx wrote: > I don't understand the problem - why should comments (and I hope you > believe there should be a one line comment at least) be restricted to one > line. It doesn't work that way for if, while, for. It is the minimum case that can solve a problem commenting one line -- or part of it as

Re: multiline comments

2006-04-19 Thread rx
"Jorge Godoy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > rx wrote: > >> I have commented out a lot of C++ code and miss the block feature in >> python more than I missed the nested comments in C++. >> Besides nothing really strange happened. >> Sometimes you just need to diss

Re: multiline comments

2006-04-19 Thread Jorge Godoy
rx wrote: > > "Jorge Godoy" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Edward Elliott wrote: >> > >> >> You can use either """ or '''. I don't keep changing them in my code, so >> I >> can always use the other type (usually I use " so for commenting things >> out >> I'd us

Re: multiline comments

2006-04-19 Thread Jorge Godoy
rx wrote: > I have commented out a lot of C++ code and miss the block feature in > python more than I missed the nested comments in C++. > Besides nothing really strange happened. > Sometimes you just need to dissable some of the code temporarly as quickly > as possible, and I like that it is not

Re: multiline comments

2006-04-19 Thread Edward Elliott
Jorge Godoy wrote: > You can use either """ or '''. I don't keep changing them in my code, so I > can always use the other type (usually I use " so for commenting things out > I'd use ') to do that. It's close, only problem is it doesn't nest. It'll have to be good enough for now. >>Forcing p

Re: multiline comments

2006-04-19 Thread Edward Elliott
Peter Tillotson wrote: > discouraged except where vital. Perhaps we should make them really hard > and elegant - mandate latex/mathml markup so good editors can display > the equations we are implementing :-) I like this guy already! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: multiline comments

2006-04-19 Thread rx
> > Also, if you remove the start of the block first, then your editor might > not > be highlighting anymore... With nested comments things get even worse > because you might miss the end of the outer block or something like that. > > -- > Jorge Godoy <[EMAIL PROTECTED]> > I have commente

Re: multiline comments

2006-04-19 Thread Edward Elliott
Jorge Godoy wrote: > Edward Elliott wrote: > Try using Subversion. You can work and make diffs disconnected from the > network. rcs isn't the issue. I'm already assuming a local store, a networked one just makes my argument even easier. >>I'm not saying nested comments solve every problem, jus

Re: multiline comments

2006-04-19 Thread Edward Elliott
Sion Arrowsmith wrote: > Jorge Godoy <[EMAIL PROTECTED]> wrote: >>Is it harder to remove "n" lines of code commented out with "#" than "n" >>lines of multiline commented code? How? > > I'd say it's harder to remove the latter, due to having to search for > the end of comment sequence, rather tha

Re: multiline comments

2006-04-19 Thread rx
"Jorge Godoy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Edward Elliott wrote: > > > You can use either """ or '''. I don't keep changing them in my code, so > I > can always use the other type (usually I use " so for commenting things > out > I'd use ') to do that. > Try

Re: multiline comments

2006-04-19 Thread Edward Elliott
Sion Arrowsmith wrote: > Really? Under what circumstances is it easier to see what's going on > with start/end comments than with comment-to-end-of-line? Off the top of my head: 1. The code is usually easier to read as # can obscure the first token on the line. This can be alleviated by leaving

Re: multiline comments

2006-04-19 Thread rx
"Edward Elliott" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ben Finney wrote: >> Indeed. Using revision control means never needing to comment out >> blocks of code. > > Typing (* and *) on a few line will always be quicker, easier, and less > confusing than any rcs diffs/rest

Re: multiline comments

2006-04-19 Thread Jorge Godoy
Sion Arrowsmith wrote: > I'd say it's harder to remove the latter, due to having to search for > the end of comment sequence, rather than simply looking for where the > block comment stops. And you've extra problems if you allow nested > comments, because then you'll have to count how deep you've

Re: multiline comments

2006-04-19 Thread Sion Arrowsmith
Jorge Godoy <[EMAIL PROTECTED]> wrote: >Is it harder to remove "n" lines of code commented out with "#" than "n" >lines of multiline commented code? How? I'd say it's harder to remove the latter, due to having to search for the end of comment sequence, rather than simply looking for where the bl

Re: multiline comments

2006-04-19 Thread Sion Arrowsmith
Edward Elliott <[EMAIL PROTECTED]> wrote: >On top of that, the expressive power of nested comments seems greater than >an endless string of ^#s. Sometimes it's just easier to see what's going on. Really? Under what circumstances is it easier to see what's going on with start/end comments than w

Re: multiline comments

2006-04-19 Thread Peter Tillotson
nice one Jorge :-) Jorge Godoy wrote: > Peter Tillotson wrote: > >> I'm not sure I agree, revision control is great but not the only answer. >> In multi-developer teams working on the trunk, it its kind of >> inconvenient if someone checks in broken code. It also blocks critical > > This is some

Re: multiline comments

2006-04-19 Thread Jorge Godoy
Edward Elliott wrote: > And when the section I want to comment out contains a legit doc string in > the middle, triple-quotes won't work. There are valid reasons to nest You can use either """ or '''. I don't keep changing them in my code, so I can always use the other type (usually I use " so

Re: multiline comments

2006-04-19 Thread Jorge Godoy
Peter Tillotson wrote: > I'm not sure I agree, revision control is great but not the only answer. > In multi-developer teams working on the trunk, it its kind of > inconvenient if someone checks in broken code. It also blocks critical This is something that should be a policy: no untested and wor

Re: multiline comments

2006-04-19 Thread Jorge Godoy
Edward Elliott wrote: > Sure they can be abused. So can a thousand other language features. My > point is you can't teach good coding through syntax, and trying to causes > more problems than it solves. I like the phrase: there are some languages that incentivates bad practices in programming;

Re: multiline comments

2006-04-19 Thread Jorge Godoy
Edward Elliott wrote: > Typing (* and *) on a few line will always be quicker, easier, and less > confusing than any rcs diffs/restores. Once you delete the code you can > no longer see it or add pieces back in without retrieving it from an > external store. Try using Subversion. You can work a

Re: multiline comments

2006-04-19 Thread Peter Tillotson
Ben Finney wrote: > "Atanas Banov" <[EMAIL PROTECTED]> writes: > >> Edward Elliott wrote: >>> Saying coders shouldn't use multiline comments to disable code >>> misses the point. Coders will comment out code regardless of the >>> existence of multiline comemnts. There has to be a better >>> argu

Re: multiline comments

2006-04-19 Thread Gregor Horvath
Edward Elliott schrieb: > On top of that, the expressive power of nested comments seems greater > than an endless string of ^#s. Sometimes it's just easier to see what's > going on. not if you are using grep -- Gregor http://www.gregor-horvath.com -- http://mail.python.org/mailman/listinfo/py

Re: multiline comments

2006-04-19 Thread Edward Elliott
Duncan Booth wrote: > Want to comment out a block of code in C++? The only (nearly) reliable way > is to insert single-line comments down the block. You can't use a block > comment if there are any other block comments inside the code you want to > block out. As Roel said, #if 0 is the standard

Re: multiline comments

2006-04-19 Thread Roel Schroeven
Duncan Booth schreef: > Would you care to name a few languages which support nested block > comments? There really aren't many: ML as you mentioned; Standard Pascal > doesn't permit nesting of comments but *some* implementations do allow it. > > Want to comment out a block of code in C++? The onl

Re: multiline comments

2006-04-19 Thread Duncan Booth
Edward Elliott wrote: > Ben Finney wrote: >> Indeed. Using revision control means never needing to comment out >> blocks of code. > > Typing (* and *) on a few line will always be quicker, easier, and > less confusing than any rcs diffs/restores. Once you delete the code > you can no longer see

Re: multiline comments

2006-04-19 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Edward Elliott <[EMAIL PROTECTED]> wrote: >ML has a >very elegant system for nested comments with (* and *). Which, if you mistype an opening or closing comment symbol, can lead to some very mysterious syntax errors. -- http://mail.python.org/mailman/listinfo/p

Re: multiline comments

2006-04-18 Thread Edward Elliott
Ben Finney wrote: > Indeed. Using revision control means never needing to comment out > blocks of code. Typing (* and *) on a few line will always be quicker, easier, and less confusing than any rcs diffs/restores. Once you delete the code you can no longer see it or add pieces back in without

Re: multiline comments

2006-04-18 Thread Edward Elliott
Ben Finney wrote: > And/or switch to an editor that can perform editing operations on a > range of lines. I'm not unsympathetic to this point of view, as I would feel hamstrung without my vim. It's more that I object to the paternalism of telling people they have to use such an editor. There a

Re: multiline comments

2006-04-18 Thread Edward Elliott
Atanas Banov wrote: > want to comment block of code? use tripple-quotes. does not nest? ahhh, > maybe it's time to get rid of that block you commented out a month ago > "just in case the new code doesnt work". > > that gives you incentive to tidy up. don't be a code slob... don't > leave a mess fo

Re: multiline comments

2006-04-18 Thread Ben Finney
"Atanas Banov" <[EMAIL PROTECTED]> writes: > Edward Elliott wrote: > > Saying coders shouldn't use multiline comments to disable code > > misses the point. Coders will comment out code regardless of the > > existence of multiline comemnts. There has to be a better > > argument for leaving them o

Re: multiline comments

2006-04-18 Thread Atanas Banov
Edward Elliott wrote: > At the risk of flogging a dead horse, I'm wondering why Python doesn't have > any multiline comments. One can abuse triple-quotes for that purpose, but > that's obviously not what it's for and doesn't nest properly. ... > Saying coders shouldn't use multiline comments to d

Re: multiline comments

2006-04-18 Thread Ben Finney
James Stroud <[EMAIL PROTECTED]> writes: > Edward Elliott wrote: > > At the risk of flogging a dead horse, I'm wondering why Python > > doesn't have any multiline comments. [...] > > > > Using an editor to throw #s in front of every line has > > limitations. Your editor has to support it and you

  1   2   >