classes vs dicts

Daniel 'Dang' Griffith noemail at noemail4u.com
Fri May 7 09:30:19 EDT 2004


On 06 May 2004 07:22:05 -0400, Heather Coppersmith <me at privacy.net>
wrote:
...
>In the end (and in the implementation), classes are just syntactic
>sugar for dictionaries.
>
>    object.attribute    is equiv. to    dictionary[ 'key' ]

I think you're overgeneralizing, or I'm reading overgenerality into
your response.  I assume you mean that manipulating an instance of a
class attribute is syntactic sugar for manipulating a single
dictionary entry?  

You can't arbitrarily add or remove attributes to an instance of a
class (without using "magic", which kinda puts a major sour in the
syntactic sugar!).  Classes are not syntactic sugar for dictionaries.
    --dang



More information about the Python-list mailing list