[Tutor] dictionary and more

Emile van Sebille emile at fenx.com
Mon Oct 11 23:03:17 CEST 2010

On 10/11/2010 9:19 AM Jack Uretsky said...
> Hi-
> I apologize for the size of the attached file, but the question would
> make little sense if I made substantial deletions.
> The program gives the following error:
> Traceback (most recent call last):
> File "/Javastuff/python/Glau_Is.py", line 131, in <module>
> Adestin[state]()
> TypeError: 'NoneType' object is not callable
> This is after the RETA prinout from function A_1, so that seems to be
> called correctly. The black screen is not part of the problem, I am not
> including the .jpeg files. Line 131 is the one that reads
> Adestin[state]()
> and the program prints (correctly) state=1 before the traceback.

Then Adestin[1] is None causing TypeError: 'NoneType' object is not 
callable.  You can verify that by printing Adestin[1] where you're 
currently printing state.

Then you'd discover that when you're building Adestin you're assigning 
the _results_ of the functions to your dictionary.  You probably want to 
leave off the parens when declaring the functions.  Further, your 
functions probably need to return something -- add return statements if 
you want the results.



More information about the Tutor mailing list