Re: [Tutor] Your thoughts on designing python code for unit testing?

2012-01-04 Thread Devin Jeanpierre
I've found that bottom-up development favors testable code. That is, rather than thinking of the problem to be solved, thinking in terms of the tools (functions) one would use to solve the problem. These tools can be written to be testable, and then it all builds up in this tower of easily-testable

Re: [Tutor] Your thoughts on designing python code for unit testing?

2012-01-04 Thread Modulok
In general, write the unit test *before* you write the code. This way your code is "designed" to be unit tested by default. It also provides a better way to verify that your implementation of a desired feature actually works as intended. For example, when I'm writing a new module I document it fir

[Tutor] Your thoughts on designing python code for unit testing?

2012-01-04 Thread brian arb
What are some of the strategies for designing code to be unit tested? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to Capture a key being pressed?

2012-01-04 Thread Alan Gauld
On 04/01/12 18:28, brandon w wrote: How do I capture a key like the bar or the key? It depends on your OS. For Windows use msvcrt and the getch() function. For other OS your best bet is curses. See the "Event Handling" topic in my tutorial for examples using both. There is a terminal modu

[Tutor] How to Capture a key being pressed?

2012-01-04 Thread brandon w
How do I capture a key like the bar or the key? Is there anything that comes in the default Python2.6.6 installation? I have found something called "termios" doing a search. Should I just use Pygame? I would like it to go cross platform if possible. Brandon __

Re: [Tutor] question about the an exercise in (including the discription about the exercise)

2012-01-04 Thread Alan Gauld
On 04/01/12 14:54, Joel Goldstick wrote: two files' content is equal, just print "equal". Else, print the rows And column number of the first different position. while True: line = f1.readline() if line != f2.readline(): print lineNum, " : ", line # in here I believe y

Re: [Tutor] question about the an exercise in (including the discription about the exercise)

2012-01-04 Thread Joel Goldstick
On Wed, Jan 4, 2012 at 9:36 AM, Alan Gauld wrote: > On 04/01/12 14:13, David Palao wrote: >> >> Hi, >> some hints: >> 1) strings are iterables > > > And so are files ;-) > >> 2) help(zip) >> 3) help(enumerate) > > >>    Write a program that compare the two files given by users. If the >>    tw

Re: [Tutor] question about the an exercise in (including the discription about the exercise)

2012-01-04 Thread Alan Gauld
On 04/01/12 14:13, David Palao wrote: Hi, some hints: 1) strings are iterables And so are files ;-) 2) help(zip) 3) help(enumerate) Write a program that compare the two files given by users. If the two files' content is equal, just print "equal". Else, print the rows And co

Re: [Tutor] question about the an exercise in (including the discription about the exercise)

2012-01-04 Thread David Palao
Hi, some hints: 1) strings are iterables 2) help(zip) 3) help(enumerate) Best regards. 2012/1/4 daedae11 > ** > Who can give me an example program about the exercise 6 in chapter 9 in > ? > > The exercise is: > Write a program that compare the two files given by users. If the two > files' cont

[Tutor] question about the an exercise in (including the discription about the exercise)

2012-01-04 Thread daedae11
Who can give me an example program about the exercise 6 in chapter 9 in ? The exercise is: Write a program that compare the two files given by users. If the two files' content is equal, just print "equal". Else, print the rows And column number of the first different position. Thank you!

Re: [Tutor] question about the exercises in

2012-01-04 Thread Walter Prins
Hi daedae11, 2012/1/4 daedae11 : > Who can give me an example program about the exercise 4 in chapter 9 in > ? > > Thank you! You're limiting the number of people who might help you by not posting the excercise/problem you're having directly and instead only giving a reference to a book the read

[Tutor] question about the exercises in

2012-01-04 Thread daedae11
Who can give me an example program about the exercise 4 in chapter 9 in ? Thank you! daedae11___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] question about the exercises in

2012-01-04 Thread daedae11
Who can give me an example program about the exercise 4 in chapter 9 in ? daedae11___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor