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

Danny Yoo dyoo at hashcollision.org
Mon Mar 31 22:00:20 CEST 2014


> 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 presentation of the bug, the presentation omits
a bit of the error message:  It presents the error message text, but
not the entire "traceback".  You don't need to do that, and in fact,
you will usually want to be verbose.  The context in which the error
occurs might be helpful: in particular, you might be misinterpreting
the subject or object of the error message.  Without seeing context,
we can't do a cursory confirmation that the error matches your
diagnosis.

 We want to verify by looking at symptoms.  Don't curtail error
messages and stack traces, but include them next time.


More information about the Tutor mailing list