type = "instance" instead of "dict"

James Stroud jstroud at ucla.edu
Wed Mar 1 06:13:28 CET 2006


Mel Wilson wrote:
> James Stroud wrote:
> 
>> Fredrik Lundh wrote:
>>
>>> James Stroud wrote:
>>>
>>>
>>>> Perhaps you did not know that you can inheret directly from dict, which
>>>> is the same as {}. For instance:
>>>>
>>>> class Dict({}):
>>>>   pass
>>
>>
>>
>> I must have been hallucinating. I swear I did this before and it 
>> worked just like class Dict(dict). Since it doesn't read as well, I've 
>> never used it.
>>
>>>
> 
> class D (type({})):
>     '''This derivative of dictionary works.'''
> 
> Could that have been it?
> 
>         Mel.

This rings a bell. It was a couple of years ago, so the "type" must have 
faded from my already murky memory.

James



More information about the Python-list mailing list