Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-04-05 Thread John Aten
I read the article on data driven programming that Danny linked too, and did some additional looking around. I couldn't find anything directly using Python, but I got an idea of the concept and went crazy with it. This may still be off the mark, but I created a complex combination of lists and

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-04-05 Thread Alan Gauld
On 05/04/14 20:53, John Aten wrote: The complete code will follow, but I have a spooky new problem. Welcome to the world of data driven programming. Its seductive but brings its own set of challenges. Structuring the data and how you format it visually makes a huge difference to your ability

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-04-05 Thread Peter Otten
John Aten wrote: I read the article on data driven programming that Danny linked too, and did some additional looking around. I couldn't find anything directly using Python, but I got an idea of the concept and went crazy with it. This may still be off the mark, but I created a complex

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-04-03 Thread John Aten
I apologize for the omissions, I thought that I had isolated the problem, but I was way off the mark. The problem was, as suggested by Danny and Peter, in the function where the dictionary is assigned. I ran the type function, as Alex advised, and lo and behold the function was returning a

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-04-03 Thread Peter Otten
John Aten wrote: I apologize for the omissions, I thought that I had isolated the problem, but I was way off the mark. The problem was, as suggested by Danny and Peter, in the function where the dictionary is assigned. I ran the type function, as Alex advised, and lo and behold the function

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-04-03 Thread Danny Yoo
The thing is, this looks really messy Could anyone give me some pointers on how this could be more elegantly done? Instead of the many if...elif switches try to put the alternatives into a list, e. g. cases = [ ... Nominative, ... Genitive, ... Dative, ... Accusative, ... Ablative ...

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-04-03 Thread Alex Kleider
On 2014-04-03 13:52, Danny Yoo wrote: You'll also hear the term Data Driven Programming or Table Driven Programming to refer to this idea. For example: http://blogs.msdn.com/b/ericlippert/archive/2004/02/24/79292.aspx Does anyone know of a similar blog or tutorial (regarding Data

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-04-03 Thread Alan Gauld
On 04/04/14 00:09, Alex Kleider wrote: On 2014-04-03 13:52, Danny Yoo wrote: You'll also hear the term Data Driven Programming or Table Driven Programming to refer to this idea. For example: http://blogs.msdn.com/b/ericlippert/archive/2004/02/24/79292.aspx Does anyone know of a

[Tutor] Storing dictionary value, indexed by key, into a variable

2014-03-31 Thread John Aten
Hey all, I am writing a program to drill the user on Latin demonstrative pronouns and adjectives (DPA). It displays a description, and the user has to enter the DPA that corresponds to the description. DPA vary for gender, number and case, and there are 3 separate DPA. I have these stored in a

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-03-31 Thread Alex Kleider
On 2014-03-31 06:38, John Aten wrote: Hey all, I am writing a program to drill the user on Latin demonstrative pronouns and adjectives (DPA). It displays a description, and the user has to enter the DPA that corresponds to the description. DPA vary for gender, number and case, and there are 3

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-03-31 Thread Peter Otten
John Aten wrote: Hey all, I am writing a program to drill the user on Latin demonstrative pronouns and adjectives (DPA). It displays a description, and the user has to enter the DPA that corresponds to the description. DPA vary for gender, number and case, and there are 3 separate DPA. I

Re: [Tutor] Storing dictionary value, indexed by key, into a variable

2014-03-31 Thread Danny Yoo
So my question is, why does Python think that D is a string? Assume that Python is telling the truth, at least unless something really unusual is happening. :P Assume D is a string. Your question should really be: why is D a string? Where does D get assigned? --- Also note that in your