Re: [Tutor] Where to start with Unit Testing

2010-08-03 Thread Mac Ryan
On Mon, 2010-08-02 at 11:59 -0400, Che M wrote: > Mac, I found this an excellent brief overview of UT and your points > all > seem very strong to me. Thanks very much. I admit I didn't really > know > anything about the topic and was mentioning my feelings on the matter > partly to elicit enlight

[Tutor] Maximum recursion depth problem.

2010-08-03 Thread Wesley Brooks
Dear Python Users, I'm having real difficulty understanding why the following is not working and hoped I've either missed something obvious of I'm doing something wrong! class A: def break_down(self, value, base, broken_list=[]): power = len(broken_list) digit = int((value % (

Re: [Tutor] Maximum recursion depth problem.

2010-08-03 Thread Wesley Brooks
Ok a little more investigation has found the follwing work but there not as tidy. I'd still really appreciate someone explaing why this behaves like this! class A: def break_down(self, value, base, broken_list=[]): power = len(broken_list) digit = (value % (base ** (power + 1))) /

Re: [Tutor] Maximum recursion depth problem.

2010-08-03 Thread Peter Otten
Wesley Brooks wrote: > I'm having real difficulty understanding why the following is not > working and hoped I've either missed something obvious of I'm doing > something wrong! > > class A: > def break_down(self, value, base, broken_list=[]): > I'm a little stumped as I don't think I'm usin

Re: [Tutor] Maximum recursion depth problem.

2010-08-03 Thread Wesley Brooks
Morning Peter, Thanks, that was something I was unaware of! Not sure how I hadn't bumped into that before! Cheers, Wesley. On 3 August 2010 11:40, Peter Otten <__pete...@web.de> wrote: > Wesley Brooks wrote: > >> I'm having real difficulty understanding why the following is not >> working and h

Re: [Tutor] Conflict with encoding in console view and file dump

2010-08-03 Thread Alex Baraibar
Hi, Peter. Sorry for the delay, I've been out for a while. So I did what you suggested and it prints the following: " import sys print >> sys.stderr, sys.stdout.encoding what does the above print (a) when you print to the console? it prints cp850 (b) when you redirect to a file? it prints None "

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-03 Thread Steven D'Aprano
On Tue, 3 Aug 2010 10:52:27 am Richard D. Moores wrote: > On Mon, Aug 2, 2010 at 16:57, Steven D'Aprano wrote: > >  # File *probably* doesn't exist. Consider better error checking. > > Steve, before I dig into your detailed reply, please tell me what you > meant by " # File *probably* doesn't exi

Re: [Tutor] Conflict with encoding in console view and file dump

2010-08-03 Thread Peter Otten
Alex Baraibar wrote: > Hi, Peter. > Sorry for the delay, I've been out for a while. > So I did what you suggested and it prints the following: > > " > import sys > print >> sys.stderr, sys.stdout.encoding > > what does the above print > (a) when you print to the console? it prints cp850 > (b) wh

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-03 Thread Richard D. Moores
On Tue, Aug 3, 2010 at 08:04, Steven D'Aprano wrote: > On Tue, 3 Aug 2010 10:52:27 am Richard D. Moores wrote: >> On Mon, Aug 2, 2010 at 16:57, Steven D'Aprano > wrote: >> >  # File *probably* doesn't exist. Consider better error checking. >> >> Steve, before I dig into your detailed reply, pleas

[Tutor] Simple Python Telnet Client (Help with Asynchronous IO)

2010-08-03 Thread Nathan Farrar
Hello All, I'm attempting to write a simple telnet client. Yes, I've been told that I should be using twisted to do this. I want to learn to do it myself first, so that I can fully understand the concepts - then I will scrap it and switch to using twisted. When I started, I didn't realize there