[EMAIL PROTECTED] (Bengt Richter) writes:
> Has anyone found a way besides not deriving from dict?
> Shouldn't there be a way?
> TIA
> (need this for what I hope is an improvement on the Larosa/Foord OrderedDict 
> ;-)
>
> I guess I can just document that you have to spell it dict(d.items()), but I'd
> like to hide the internal shenanigans ;-)

So why not just hide them:

>>> class md(dict):
...  def __new__(cls, arg):
...   return dict.__new__(cls, arg.items())


I'm not sure exactly what you mean by "grabbing sublass inst d contens
directly", but if dict(d.items()) does it, the above class should do
it as well. Of course, *other* ways of initializing a dict won't work
for this class.

    <mike
-- 
Mike Meyer <[EMAIL PROTECTED]>                  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to