[Tutor] Simple Question (I Hope)

Alan Gauld alan.gauld at btinternet.com
Mon Jan 16 09:19:04 CET 2012


On 16/01/12 01:47, Chris Kavanagh wrote:

> Thanks for the help. . .I think I see what you're saying. And to make it
> short & simple, the MIMEText Class behaves the way it does, because
> that's just how it works (or was designed). So just accept it, & move
> on, lol.

Not quite.
What we are saying is that yhour assumption that only dictionaries 
exhibited mapping behaviour was wrong. Any class can be made to look 
like a dictionary by implementing the set/getitem() methods. So the 
lesson to take away is not just to accept these things but to look under 
the covers to see how such anomolies are possible. Python is a 
wonderfully flexible language because of its combination of duck typing 
and operator overloading.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list