Re: n00b question on spacing

2013-06-25 Thread Chris Angelico
On Tue, Jun 25, 2013 at 9:59 PM, Robert Kern wrote: > On 2013-06-25 12:48, Chris Angelico wrote: >> >> On Tue, Jun 25, 2013 at 9:19 PM, Robert Kern >> wrote: >>> >>> There is quite a bit of Python's lexical analysis that is specified in >>> places other than the formal notation. That does not mea

Re: n00b question on spacing

2013-06-25 Thread Robert Kern
On 2013-06-25 12:48, Chris Angelico wrote: On Tue, Jun 25, 2013 at 9:19 PM, Robert Kern wrote: There is quite a bit of Python's lexical analysis that is specified in places other than the formal notation. That does not mean it is undefined. It is well defined in the lexer code and the documenta

Re: n00b question on spacing

2013-06-25 Thread Chris Angelico
On Tue, Jun 25, 2013 at 9:19 PM, Robert Kern wrote: > There is quite a bit of Python's lexical analysis that is specified in > places other than the formal notation. That does not mean it is undefined. > It is well defined in the lexer code and the documentation. You suggest that > a "rule probabl

Re: n00b question on spacing

2013-06-25 Thread Robert Kern
On 2013-06-25 01:22, Mark Janssen wrote: On Mon, Jun 24, 2013 at 4:48 PM, alex23 wrote: On 23/06/2013 3:43 AM, Mark Janssen wrote: There was a recent discussion about this (under "implicit string concatenation"). It seems this is a part of the python language specification that was simply un

Re: n00b question on spacing

2013-06-24 Thread Mark Janssen
On Mon, Jun 24, 2013 at 4:48 PM, alex23 wrote: > On 23/06/2013 3:43 AM, Mark Janssen wrote: >> >> There was a recent discussion about this (under "implicit string >> concatenation"). It seems this is a part of the python language >> specification that was simply undefined. > > > It's part of the

Re: n00b question on spacing

2013-06-24 Thread alex23
On 23/06/2013 3:43 AM, Mark Janssen wrote: There was a recent discussion about this (under "implicit string concatenation"). It seems this is a part of the python language specification that was simply undefined. It's part of the language reference, not an accidental artifact: http://docs.pyth

Re: n00b question on spacing

2013-06-23 Thread Terry Reedy
On 6/22/2013 9:20 PM, MRAB wrote: [snip] One vs not-one isn't good enough. Some languages use the singular with any numbers ending in '1'. Some languages have singular, dual, and plural. Etc. It's surprising how inventive people can be! :-) In the Idle output window for file grepping, I just c

Re: n00b question on spacing

2013-06-23 Thread Roy Smith
In article <51c66a03$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sat, 22 Jun 2013 23:12:49 -0400, Roy Smith wrote: > > Number 2 on the list is "Months have either 30 or 31 days", which was > > obviously believed by whoever made this sign: http://tinyurl.com/mgv39on

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 12:58 PM, Steven D'Aprano wrote: > On Sun, 23 Jun 2013 02:20:56 +0100, MRAB wrote: > >> One vs not-one isn't good enough. Some languages use the singular with >> any numbers ending in '1'. Some languages have singular, dual, and >> plural. Etc. It's surprising how inventive

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 1:22 PM, Steven D'Aprano wrote: > On Sat, 22 Jun 2013 23:12:49 -0400, Roy Smith wrote: > >> In article <51c66455$0$2$c3e8da3$54964...@news.astraweb.com>, >> Steven D'Aprano wrote: >> >>> http://infiniteundo.com/post/25326999628/falsehoods-programmers- > believe-about-

Re: n00b question on spacing

2013-06-22 Thread Steven D'Aprano
On Sat, 22 Jun 2013 23:12:49 -0400, Roy Smith wrote: > In article <51c66455$0$2$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> http://infiniteundo.com/post/25326999628/falsehoods-programmers- believe-about- >> time > > Number 2 on the list is "Months have either 30 or 3

Re: n00b question on spacing

2013-06-22 Thread Roy Smith
In article <51c66455$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about- > time Number 2 on the list is "Months have either 30 or 31 days", which was obviously believed by whoever made this sign: h

Re: n00b question on spacing

2013-06-22 Thread Steven D'Aprano
On Sun, 23 Jun 2013 02:20:56 +0100, MRAB wrote: > One vs not-one isn't good enough. Some languages use the singular with > any numbers ending in '1'. Some languages have singular, dual, and > plural. Etc. It's surprising how inventive people can be! :-) This is a good time to link to these intere

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 10:48 AM, Rick Johnson wrote: > On Saturday, June 22, 2013 6:12:50 PM UTC-5, Chris Angelico wrote: >> As a general rule, I don't like separating format strings and their >> arguments. > > Huh? Format strings don't take arguments because Python's built-in string > type is n

Re: n00b question on spacing

2013-06-22 Thread Dave Angel
On 06/22/2013 09:20 PM, MRAB wrote: On 23/06/2013 00:56, Dave Angel wrote: Certainly the reorderability of the format string is significant. Not only can it be reordered, but more than one instance of some of the values is permissible if needed. (What's missing is a decent handling of

Re: n00b question on spacing

2013-06-22 Thread MRAB
On 23/06/2013 00:56, Dave Angel wrote: On 06/22/2013 07:37 PM, Chris Angelico wrote: On Sun, Jun 23, 2013 at 9:28 AM, Dave Angel wrote: On 06/22/2013 07:12 PM, Chris Angelico wrote: On Sun, Jun 23, 2013 at 1:24 AM, Rick Johnson wrote: _fmtstr = "Item wrote to MongoDB database {0}, {1}

Re: n00b question on spacing

2013-06-22 Thread Rick Johnson
On Saturday, June 22, 2013 6:12:50 PM UTC-5, Chris Angelico wrote: > As a general rule, I don't like separating format strings and their > arguments. Huh? Format strings don't take arguments because Python's built-in string type is not callable. py> callable("") False "Format string" is ju

Re: n00b question on spacing

2013-06-22 Thread Dave Angel
On 06/22/2013 08:27 PM, Chris Angelico wrote: On Sun, Jun 23, 2013 at 9:56 AM, Dave Angel wrote: On 06/22/2013 07:37 PM, Chris Angelico wrote: On the contrary, i18n should be done with config files. The format string **as specified in the physical program** is the key to the actual stri

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 9:56 AM, Dave Angel wrote: > On 06/22/2013 07:37 PM, Chris Angelico wrote: >>> On the contrary, i18n should be done with config files. The format >>> string > > > **as specified in the physical program** > > >>> is the key to the actual string which is located in the file/

Re: n00b question on spacing

2013-06-22 Thread Dave Angel
On 06/22/2013 07:37 PM, Chris Angelico wrote: On Sun, Jun 23, 2013 at 9:28 AM, Dave Angel wrote: On 06/22/2013 07:12 PM, Chris Angelico wrote: On Sun, Jun 23, 2013 at 1:24 AM, Rick Johnson wrote: _fmtstr = "Item wrote to MongoDB database {0}, {1}" msg = _fmtstr.format(_arg1, _arg2)

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 9:28 AM, Dave Angel wrote: > On 06/22/2013 07:12 PM, Chris Angelico wrote: >> >> On Sun, Jun 23, 2013 at 1:24 AM, Rick Johnson >> wrote: >>> >>>_fmtstr = "Item wrote to MongoDB database {0}, {1}" >>>msg = _fmtstr.format(_arg1, _arg2) >> >> >> As a general rule, I d

Re: n00b question on spacing

2013-06-22 Thread Dave Angel
On 06/22/2013 07:12 PM, Chris Angelico wrote: On Sun, Jun 23, 2013 at 1:24 AM, Rick Johnson wrote: _fmtstr = "Item wrote to MongoDB database {0}, {1}" msg = _fmtstr.format(_arg1, _arg2) As a general rule, I don't like separating format strings and their arguments. That's one of the more

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 1:24 AM, Rick Johnson wrote: > _fmtstr = "Item wrote to MongoDB database {0}, {1}" > msg = _fmtstr.format(_arg1, _arg2) As a general rule, I don't like separating format strings and their arguments. That's one of the more annoying costs of i18n. Keep them in a single e

Re: n00b question on spacing

2013-06-22 Thread Ned Deily
In article , Mark Janssen wrote: > > Also remember when entering long lines of text that strings concatenate > > within parenthesis. > > So, > > ("a, b, c" > > "d, e, f" > > "g, h, i") > > > > Is the same as ("a, b, cd, e, fg, h, i") > There was a recent discussion about this (under "implicit s

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 18:28, Alister wrote: > On Sat, 22 Jun 2013 17:11:00 +0100, Joshua Landau wrote: > >> On 22 June 2013 16:55, Rick Johnson >> wrote: >>> On Saturday, June 22, 2013 10:40:24 AM UTC-5, Joshua Landau wrote: > Plus, your use of the format syntax is incorrect. Wut? >>> >>> Wel

Re: n00b question on spacing

2013-06-22 Thread Mark Janssen
> Also remember when entering long lines of text that strings concatenate > within parenthesis. > So, > ("a, b, c" > "d, e, f" > "g, h, i") > > Is the same as ("a, b, cd, e, fg, h, i") There was a recent discussion about this (under "implicit string concatenation"). It seems this is a part of the

Re: n00b question on spacing

2013-06-22 Thread Alister
On Sat, 22 Jun 2013 17:11:00 +0100, Joshua Landau wrote: > On 22 June 2013 16:55, Rick Johnson > wrote: >> On Saturday, June 22, 2013 10:40:24 AM UTC-5, Joshua Landau wrote: >>> > Plus, your use of the format syntax is incorrect. >>> Wut? >> >> Well what i mean exactly is not that it's illegal, i

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 16:55, Rick Johnson wrote: > On Saturday, June 22, 2013 10:40:24 AM UTC-5, Joshua Landau wrote: >> > Plus, your use of the format syntax is incorrect. >> Wut? > > Well what i mean exactly is not that it's illegal, i just > find the use of the "getattr sugar", from WITHIN the format

Re: n00b question on spacing

2013-06-22 Thread Rick Johnson
On Saturday, June 22, 2013 10:40:24 AM UTC-5, Joshua Landau wrote: > > Plus, your use of the format syntax is incorrect. > Wut? Well what i mean exactly is not that it's illegal, i just find the use of the "getattr sugar", from WITHIN the format string, to be excessively noisy. In short, i don't

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 14:36, Joshua Landau wrote: > My favourite way would be along the lines of: > > message = "Item wrote to MongoDB database " > message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) > log.msg(message, level=log.DEBUG, spider=spider) To make a habit of replying to mys

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 16:24, Rick Johnson wrote: > On Saturday, June 22, 2013 8:36:43 AM UTC-5, Joshua Landau wrote: >> message = "Item wrote to MongoDB database " >> message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) >> log.msg(message, level=log.DEBUG, spider=spider) > > If you're g

Re: n00b question on spacing

2013-06-22 Thread Rick Johnson
On Saturday, June 22, 2013 8:36:43 AM UTC-5, Joshua Landau wrote: > message = "Item wrote to MongoDB database " > message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) > log.msg(message, level=log.DEBUG, spider=spider) If you're going to whore out parts of the string to variables i

Re: n00b question on spacing

2013-06-22 Thread Mark Lawrence
On 22/06/2013 14:36, Joshua Landau wrote: On 21 June 2013 23:26, Gary Herron wrote: On 06/21/2013 02:17 PM, Yves S. Garret wrote: I have the following line of code: log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']), level=log.DEBUG, spider

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 14:36, Joshua Landau wrote: > message = "Item wrote to MongoDB database " Pedant's note: "Item *written* to MongoDB database" -- http://mail.python.org/mailman/listinfo/python-list

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 21 June 2013 23:26, Gary Herron wrote: > On 06/21/2013 02:17 PM, Yves S. Garret wrote: >> I have the following line of code: >> log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], >> settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider) <...> >> I was thinking of

Re: n00b question on spacing

2013-06-22 Thread Ben Finney
"Yves S. Garret" writes: > I have the following line of code: > log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], > settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider) […] > Is this ok? Are there any rules in Python when it comes to breaking up > long lines of

Re: n00b question on spacing

2013-06-21 Thread Peter Otten
Yves S. Garret wrote: > Hi, I have a question about breaking up really long lines of code in > Python. > > I have the following line of code: > log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], > settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider) > > Given th

Re: n00b question on spacing

2013-06-21 Thread Steven D'Aprano
On Fri, 21 Jun 2013 17:48:54 -0400, Ray Cote wrote: > Also remember when entering long lines of text that strings concatenate > within parenthesis. So, > ("a, b, c" > "d, e, f" > "g, h, i") > > Is the same as ("a, b, cd, e, fg, h, i") Technically, you don't need the parentheses. You can also us

Re: n00b question on spacing

2013-06-21 Thread Terry Reedy
On 6/21/2013 5:17 PM, Yves S. Garret wrote: Hi, I have a question about breaking up really long lines of code in Python. I have the following line of code: log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider) G

Re: n00b question on spacing

2013-06-21 Thread Gary Herron
On 06/21/2013 02:17 PM, Yves S. Garret wrote: Hi, I have a question about breaking up really long lines of code in Python. I have the following line of code: log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spide

Re: n00b question on spacing

2013-06-21 Thread Yves S. Garret
On Fri, Jun 21, 2013 at 5:48 PM, Ray Cote wrote: > > -- > > *From: *"Yves S. Garret" > *To: *python-list@python.org > *Sent: *Friday, June 21, 2013 5:17:28 PM > *Subject: *n00b question on spacing > > > Hi, I have a question about breaking up really long lines of code

Re: n00b question on spacing

2013-06-21 Thread Ray Cote
- Original Message - > From: "Yves S. Garret" > To: python-list@python.org > Sent: Friday, June 21, 2013 5:17:28 PM > Subject: n00b question on spacing > Hi, I have a question about breaking up really long lines of code in > Python. > I have the following line of code: > log.msg("Item w

Re: n00b question on spacing

2013-06-21 Thread John Gordon
In "Yves S. Garret" writes: > Hi, I have a question about breaking up really long lines of code in Python. > I have the following line of code: > log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], > settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider) > Given