Re: [Tutor] decorators

2011-06-24 Thread Steven D'Aprano
Prasad, Ramit wrote: Excellent explanation Steven; I understood the mechanical basics but this has made the reason behind it a lot clearer. If test_argument is only being passed the function how does it have access to the arguments? It doesn't. There are three functions involved. The first is

Re: [Tutor] decorators

2011-06-24 Thread python
Steven, > Here's my cheap introduction to decorators... Beautifully explained! Thank you, Malcolm (not the OP) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] decorators

2011-06-24 Thread Prasad, Ramit
Excellent explanation Steven; I understood the mechanical basics but this has made the reason behind it a lot clearer. If test_argument is only being passed the function how does it have access to the arguments? Or is that more syntactic sugar / abbreviation for explanation? def test_argument(

Re: [Tutor] set the BETWEEN range in the SQL query using the python datetime function

2011-06-24 Thread Norman Khine
On Fri, Jun 24, 2011 at 1:31 PM, Christian Witts wrote: > On 2011/06/24 01:19 PM, Norman Khine wrote: > > thank you, it was simpler than what i was trying to do, here is the > revised version: > > http://pastie.org/2115586 > > one thing i am getting an error is on like 103, in that if, i change >

Re: [Tutor] set the BETWEEN range in the SQL query using the python datetime function

2011-06-24 Thread Christian Witts
On 2011/06/24 01:19 PM, Norman Khine wrote: thank you, it was simpler than what i was trying to do, here is the revised version: http://pastie.org/2115586 one thing i am getting an error is on like 103, in that if, i change (http://pastie.org/2115615): -plt.legend(('Income - GBP', 'Discounts',

Re: [Tutor] set the BETWEEN range in the SQL query using the python datetime function

2011-06-24 Thread Peter Otten
Norman Khine wrote: > thank you, it was simpler than what i was trying to do, here is the > revised version: > > http://pastie.org/2115586 > > one thing i am getting an error is on like 103, in that if, i change > (http://pastie.org/2115615): > > -plt.legend(('Income - GBP', 'Discounts', 'Googl

Re: [Tutor] set the BETWEEN range in the SQL query using the python datetime function

2011-06-24 Thread Norman Khine
thank you, it was simpler than what i was trying to do, here is the revised version: http://pastie.org/2115586 one thing i am getting an error is on like 103, in that if, i change (http://pastie.org/2115615): -plt.legend(('Income - GBP', 'Discounts', 'Google AdWords - GBP', 'Commission - %s GBP'

Re: [Tutor] set the BETWEEN range in the SQL query using the python datetime function

2011-06-24 Thread Peter Otten
Norman Khine wrote: > hello, i have this code http://pastie.org/2112997 > > but i am not sure how to make the date range so that i get a list > based on the daily totals not the results i am now getting: > > (2L, Decimal('173.958344'), Decimal('159.966349')) 2011-06-23 00:00:00 > 2011-06-23 23:5

Re: [Tutor] Trivia

2011-06-24 Thread Alan Gauld
"Vincent Balmori" wrote Can you please explain more on what you mean by this? "Your whole approach is very fragile in this respect, it only takes one small mistake in the data to wreck your program,. Your program relies on your data being exactly right. It only takes one missed newline,

Re: [Tutor] Trivia

2011-06-24 Thread Vincent Balmori
"Your whole approach is very fragile in this respect, it only takes one small mistake in the data to wreck your program,. Somethjing like a config file format would be much more robust (and readable) the config reader module would make sure you got what you expected back. " Can you please exp

Re: [Tutor] Trivia

2011-06-24 Thread Alan Gauld
"Vincent Balmori" wrote It's working fine now with the scoring, but now at the end of the program for some reason I get this error message: "/Users/vincentbalmori/Desktop/Python/py3e_source/chapter07/trivia_challenge2.py", line 27, in next_block point = int(next_line(the_file)) ValueErr

Re: [Tutor] Trivia

2011-06-24 Thread Andre Engels
On Fri, Jun 24, 2011 at 8:56 AM, Vincent Balmori wrote: > > << > point = int(next_line(the_file)) > > If x is a string that can be interpreted as an integer number, int(x) is > that integer number; if the string is not the representation of an integer, > this will lead to a ValueError. > > -- > An