Re: Help me understand this logging config

2011-09-02 Thread Vinay Sajip
On Aug 30, 1:39 pm, Roy Smith r...@panix.com wrote: Oh, my, it turns out that django includes: # This is a copy of the Pythonlogging.config.dictconfig module, # reproduced with permission. It is provided here for backwards

Re: Help me understand this logging config

2011-09-02 Thread Vinay Sajip
On Aug 30, 1:39 pm, Roy Smith r...@panix.com wrote: Oh, my, it turns out that django includes: # This is a copy of the Pythonlogging.config.dictconfig module, # reproduced with permission. It is provided here for backwards # compatibility for Python versions prior to 2.7. Comparing the

Re: Help me understand this logging config

2011-09-02 Thread Vinay Sajip
On Aug 30, 1:39 pm, Roy Smith r...@panix.com wrote: Oh, my, it turns out that django includes: # This is a copy of the Pythonlogging.config.dictconfig module, # reproduced with permission. It is provided here for backwards # compatibility for Python versions prior to 2.7. Comparing the

Re: Help me understand this logging config

2011-08-30 Thread Peter Otten
Roy Smith wrote: I'm using django 1.3 and python 2.6. Isn't dictConfig() new in 2.7? It looks like that is what you are using... My logging config is: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format':

Re: Help me understand this logging config

2011-08-30 Thread anand jeyahar
Hi, I took a look at the logging source code. getLogger checks for existing loggers with the given name and if it doesn't creates one. def getLogger(self, name): Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a

Re: Help me understand this logging config

2011-08-30 Thread Roy Smith
In article mailman.566.1314696279.27778.python-l...@python.org, Peter Otten __pete...@web.de wrote: Roy Smith wrote: I'm using django 1.3 and python 2.6. Isn't dictConfig() new in 2.7? It looks like that is what you are using... Oh, my, it turns out that django includes: # This is a

Help me understand this logging config

2011-08-29 Thread Roy Smith
I'm using django 1.3 and python 2.6. My logging config is: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(asctime)s: %(name)s %(levelname)s % (funcName)s %(message)s' } }, 'handlers':

Help me understand this script

2007-09-05 Thread Ryan J Nauman
Can someone help me understand this script please? I understand everything except for the anagram function. Could you break it down into more than 1 line of code for me or explain it? (I understand WHAT it does but HOW?) Thanks. Script ### # SCRABBLE.PY # # purpose: # find usable

Re: Help me understand this script

2007-09-05 Thread Gerardo Herzig
Ryan J Nauman wrote: Can someone help me understand this script please? I understand everything except for the anagram function. Could you break it down into more than 1 line of code for me or explain it? (I understand WHAT it does but HOW?) Thanks. Script ### # SCRABBLE.PY # # purpose

Re: Help me understand this

2007-01-31 Thread Christophe
James Stroud a écrit : Beej wrote: (2).__add__(1) Nice. I would have never thought to put parentheses around an integer to get at its attributes. James You can also do it like that : 2 .__add__(1) 3 -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me understand this

2007-01-30 Thread Beej
On Jan 29, 11:47 pm, Steven D'Aprano [EMAIL PROTECTED] wrote: Outside of a print statement (and also an except statement), commas create tuples. And function calls: 3, (3,) type(3,) type 'int' type((3,)) type 'tuple' But here's one I still don't get: type(2) type 'int' type((2)) type

Re: Help me understand this

2007-01-30 Thread Diez B. Roggisch
Beej wrote: On Jan 29, 11:47 pm, Steven D'Aprano [EMAIL PROTECTED] wrote: Outside of a print statement (and also an except statement), commas create tuples. And function calls: 3, (3,) type(3,) type 'int' type((3,)) type 'tuple' But here's one I still don't get: type(2) type

Re: Help me understand this

2007-01-30 Thread James Stroud
Beej wrote: (2).__add__(1) Nice. I would have never thought to put parentheses around an integer to get at its attributes. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me understand this

2007-01-30 Thread Gabriel Genellina
En Tue, 30 Jan 2007 06:34:01 -0300, Beej [EMAIL PROTECTED] escribió: But here's one I still don't get: type(2) type 'int' type((2)) type 'int' (2).__add__(1) 3 2.__add__(1) File stdin, line 1 2.__add__(1) ^ SyntaxError: invalid syntax It appears to be a bug, either

Re: Help me understand this

2007-01-30 Thread Jean-Paul Calderone
On Tue, 30 Jan 2007 14:39:28 -0300, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 30 Jan 2007 06:34:01 -0300, Beej [EMAIL PROTECTED] escribió: But here's one I still don't get: type(2) type 'int' type((2)) type 'int' (2).__add__(1) 3 2.__add__(1) File stdin, line 1

Re: Help me understand this

2007-01-30 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Jean-Paul Calderone wrote: An integer is a primary so 2.__add(1) should be valid. A float is, too. 2.__add is a float followed by an identifier. Not legal. As pointed out elsewhere in the thread, (2). forces it to be an integer followed by a .. A space between the

Re: Help me understand this

2007-01-30 Thread Neil Cerutti
On 2007-01-30, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 30 Jan 2007 06:34:01 -0300, Beej [EMAIL PROTECTED] escribió: But here's one I still don't get: type(2) type 'int' type((2)) type 'int' (2).__add__(1) 3 2.__add__(1) File stdin, line 1 2.__add__(1) ^

Re: Help me understand this

2007-01-30 Thread Beej
On Jan 30, 1:38 am, Diez B. Roggisch [EMAIL PROTECTED] wrote: Because 2. is the start of a float-literal. That isn't distinguishable for the parsere otherwise. Oh, excellent! I wonder why I didn't think of that--I was too busy in get a field mode it didn't even occur to me that the . had a

Re: Help me understand this

2007-01-30 Thread Beej
On Jan 30, 9:52 am, Jean-Paul Calderone [EMAIL PROTECTED] wrote: A float is, too. 2.__add is a float followed by an identifier. Not legal. As pointed out elsewhere in the thread, (2). forces it to be an integer followed by a .. Which leads to these two beauties: (2.).__add__(1) 3.0

Help me understand this

2007-01-29 Thread ArdPy
Hi, Pls tell me whats going on in the code snippet below: n = 10 statstr = N = ,n type(statstr) #case1 type 'tuple' print statstr ('N = ', 10) print N = ,n #case 2 N = 10 In the first case the result is printed as a tuple and

Re: Help me understand this

2007-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2007 23:05:37 -0800, ArdPy wrote: Hi, Pls tell me whats going on in the code snippet below: n = 10 statstr = N = ,n type(statstr) #case1 type 'tuple' print statstr ('N = ', 10) print N = ,n #case 2 N = 10

Help me understand this iterator

2006-10-31 Thread LaundroMat
Hi, I've found this script over at effbot (http://effbot.org/librarybook/os-path.htm), and I can't get my head around its inner workings. Here's the script: import os class DirectoryWalker: # a forward iterator that traverses a directory tree def __init__(self, directory):

Re: Help me understand this iterator

2006-10-31 Thread Fredrik Lundh
LaundroMat wrote: Now, if I look at this script step by step, I don't understand: - what is being iterated over (what is being called by file in DirectoryWalker()?); as explained in the text above the script, this class emulates a sequence. it does this by implementing the __getindex__

Re: Help me understand this iterator

2006-10-31 Thread Peter Otten
LaundroMat wrote: Hi, I've found this script over at effbot (http://effbot.org/librarybook/os-path.htm), and I can't get my head around its inner workings. Here's the script: import os class DirectoryWalker: # a forward iterator that traverses a directory tree def

Re: Help me understand this iterator

2006-10-31 Thread Steven D'Aprano
On Tue, 31 Oct 2006 03:36:08 -0800, LaundroMat wrote: Hi, I've found this script over at effbot (http://effbot.org/librarybook/os-path.htm), and I can't get my head around its inner workings. [snip code] Now, if I look at this script step by step, I don't understand: - what is being

Re: Help me understand this iterator

2006-10-31 Thread Peter Otten
LaundroMat wrote: [me hitting send too soon] Now, if I look at this script step by step, I don't understand: - where the while 1:-loop is quitted. class DirectoryWalker: # a forward iterator that traverses a directory tree def __init__(self, directory): self.stack =

Re: Help me understand this iterator

2006-10-31 Thread LaundroMat
Ack, I get it now. It's not the variable's name (index) that is hard-coded, it's just that the for...in... loop sends an argument by default. That's a lot more comforting. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me understand this iterator

2006-10-31 Thread LaundroMat
Thanks all, those were some great explanations. It seems I have still still a long way for me to go before I grasp the intricacies of this language. That 'magic index' variable bugs me a little however. It gives me the same feeling as when I see hard-coded variables. I suppose the generator class

Re: Help me understand this iterator

2006-10-31 Thread Fredrik Lundh
LaundroMat wrote: That 'magic index' variable bugs me a little however. It gives me the same feeling as when I see hard-coded variables. what magic index? the variable named index is an argument to the method it's used in. /F -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me understand this iterator

2006-10-31 Thread LaundroMat
On Oct 31, 3:53 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: LaundroMat wrote: That 'magic index' variable bugs me a little however. It gives me the same feeling as when I see hard-coded variables.what magic index? the variable named index is an argument to the method it's used in. Yes, I

Please help me understand this code....

2005-06-17 Thread randy
Hello, I am a programmer, but not a python guy. So I am a little confused with the following python code. Specifically what does the : do in the array arithmetic? new_page = map[opage] old_page = map[opage^1] center = new_page[1:-1,1:-1] origcenter = array(center) center[:]

Re: Please help me understand this code....

2005-06-17 Thread Jordan Rastrick
The : is used in Python for slice notation, which is explained pretty thoroughly in the Python tutorial, specifically at: http://www.python.org/doc/2.4/tut/node5.html -- http://mail.python.org/mailman/listinfo/python-list