Re: [Tutor] List of ints

2015-03-02 Thread Mark Lawrence
On 03/03/2015 06:50, Phil wrote: Thank you for reading this. Python 3 under Linux. I'd like to set up a two dimensional list of counters as follows; count = [ [0], [0], [0] ] And then increment the first counter as follows; count [0] += 1 This

[Tutor] List of ints

2015-03-02 Thread Phil
Thank you for reading this. Python 3 under Linux. I'd like to set up a two dimensional list of counters as follows; count = [ [0], [0], [0] ] And then increment the first counter as follows; count [0] += 1 This fails with the following error; TypeE

Re: [Tutor] text file help

2015-03-02 Thread Alan Gauld
Forwarding to list too. On 02/03/15 19:04, Tihomir Zjajic wrote: kl_number = [] myfile = open("formular_doznake.txt") for line in "formular_doznake": Note that you want to iterate over the file not the name of the file. The code above sets line to each character in the file name. You want to

Re: [Tutor] Use python to parse the subject line of emails, listen for and react to commands

2015-03-02 Thread Danny Yoo
Hi Willie, Ok, spent a few minutes looking over the code. I'll spend a brief moment reviewing the following block: > msg = email.message_from_string(data[0][1]) > decode = email.header.decode_header(msg['Subject'])[0] > subject = unicode(decode[0]) > print '%s' %

Re: [Tutor] Use python to parse the subject line of emails, listen for and react to commands

2015-03-02 Thread Danny Yoo
> The code is not pretty and I have no doubt that there are thousands of ways > for it to be hacked or messed up since there is little to no error checking > in it. I don’t know enough to do so yet sorry I am doing the best I can and > have only started learning python a week ago. Yikes! My a

Re: [Tutor] What exactly is "state"?

2015-03-02 Thread Dave Angel
On 03/02/2015 01:42 PM, Sydney Shall wrote: Thank you very much, Joel, Danny, Alan and Dave. Your explanations are all very clear and very enlightening. I shall have to change several of my unittests now. In good time. I am particularly pleased with the examples; they clarify matters considerabl

Re: [Tutor] What exactly is "state"?

2015-03-02 Thread Sydney Shall
On 02/03/2015 18:03, Dave Angel wrote: On 03/02/2015 11:25 AM, Sydney Shall wrote: I am a beginner and I am now at the strage of learning to write unittests. I have followed the current discussion entitled "How to test a class in pyhton", and I am not clear precisely what is meant by state. In i

Re: [Tutor] What exactly is "state"?

2015-03-02 Thread Dave Angel
On 03/02/2015 11:25 AM, Sydney Shall wrote: I am a beginner and I am now at the strage of learning to write unittests. I have followed the current discussion entitled "How to test a class in pyhton", and I am not clear precisely what is meant by state. In its common meaning I can see some relevan

Re: [Tutor] What exactly is "state"?

2015-03-02 Thread Alan Gauld
On 02/03/15 16:25, Sydney Shall wrote: I am not clear precisely what is meant by state. In its common meaning I can see some relevance. But is there a technical aspect to the notion. Yes, although it is related to the normal vernacular meaning. There is a whole area of math/engineering dedicat

Re: [Tutor] What exactly is "state"?

2015-03-02 Thread Danny Yoo
On Mon, Mar 2, 2015 at 8:25 AM, Sydney Shall wrote: > I am a beginner and I am now at the strage of learning to write unittests. > I have followed the current discussion entitled "How to test a class in > pyhton", and I am not clear precisely what is meant by state. In its common > meaning I can s

Re: [Tutor] What exactly is "state"?

2015-03-02 Thread Joel Goldstick
On Mon, Mar 2, 2015 at 11:25 AM, Sydney Shall wrote: > I am a beginner and I am now at the strage of learning to write unittests. > I have followed the current discussion entitled "How to test a class in > pyhton", and I am not clear precisely what is meant by state. In its common > meaning I can

[Tutor] What exactly is "state"?

2015-03-02 Thread Sydney Shall
I am a beginner and I am now at the strage of learning to write unittests. I have followed the current discussion entitled "How to test a class in pyhton", and I am not clear precisely what is meant by state. In its common meaning I can see some relevance. But is there a technical aspect to the

Re: [Tutor] BinaryTrees

2015-03-02 Thread Marcos Almeida Azevedo
On Sun, Mar 1, 2015 at 4:20 AM, Fatimah Taghdi wrote: > So i am doing this assignment and we have make a function that changes a > binary tree represenation list of lists to nodes and I was wondering if > Maybe share the starting code given to you? Or code you already have? > somone can help

Re: [Tutor] How to test a class in python?

2015-03-02 Thread Alan Gauld
On 02/03/15 04:41, Danny Yoo wrote: In a test case for a class, we have a few more things in hand. 1. The class being tested. 2. The parameters we use to create the class instance. 3. The particular method of the class that we're testing. 4. The parameters we're going to pas