Georg Brandl wrote:
Georg Brandl wrote:
Hello,
in follow-up to the recent "dictionary accumulator" thread, I wrote a
little module with several subclassed dicts.
Comments (e.g. makes it sense to use super), corrections, etc.? Is this
PEP material?
Docstrings, Documentation and test cases are to be
Georg Brandl wrote:
> Hello,
>
> in follow-up to the recent "dictionary accumulator" thread, I wrote a
> little module with several subclassed dicts.
>
> Comments (e.g. makes it sense to use super), corrections, etc.? Is this
> PEP material?
>
> Docstrings, Documentation and test cases are to be
Georg Brandl wrote:
> Michele Simionato wrote:
>> About not using super: you might have problems in multiple inheritance.
>> Suppose I want to use both your defaultdict and a thirdpartdict. A
>> subclass
>>
>> class mydict(defaultdict, thirdpartdict):
>>pass
>>
>> would not work if thirdpartd
Michele Simionato wrote:
> About not using super: you might have problems in multiple inheritance.
> Suppose I want to use both your defaultdict and a thirdpartdict. A
> subclass
>
> class mydict(defaultdict, thirdpartdict):
>pass
>
> would not work if thirdpartdict requires a non-trivial __i
About not using super: you might have problems in multiple inheritance.
Suppose I want to use both your defaultdict and a thirdpartdict. A
subclass
class mydict(defaultdict, thirdpartdict):
pass
would not work if thirdpartdict requires a non-trivial __init__ , since
without super in defaultdic
Michael Spencer:
> Alternatively, you could provide factory functions to construct the
defaultdict.
> Someone (Michele?) recently posted an implementation of this
Yes, here is the link for the ones who missed that thread:
http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/a0b
Michael Spencer wrote:
> Georg Brandl wrote:
>
>>
>> I think I like Jeff's approach more (defaultvalues are just special
>> cases of default factories); there aren't many "hoops" required.
>> Apart from that, the names just get longer ;)
>
> Yes Jeff's approach does simplify the implementation a
Georg Brandl wrote:
I think I like Jeff's approach more (defaultvalues are just special
cases of default factories); there aren't many "hoops" required.
Apart from that, the names just get longer ;)
Yes Jeff's approach does simplify the implementation and more-or-less eliminates
my complexity obje
Michael Spencer wrote:
> 1. Given that these are specializations, why not have:
>
> class defaultvaluedict(dict):
> ...
>
> class defaultfactorydict(dict):
> ...
>
> rather than having to jump through hoops to make one implementation satisfy
> both
> cases
I think I like Jeff's app
Georg Brandl wrote:
Hello,
in follow-up to the recent "dictionary accumulator" thread, I wrote a
little module with several subclassed dicts.
Comments (e.g. makes it sense to use super), corrections, etc.? Is this
PEP material?
Docstrings, Documentation and test cases are to be provided later.
mfg
Jeff Epler wrote:
> The software you used to post this message wrapped some of the lines of
> code. For example:
>> def __delitem__(self, key):
>> super(keytransformdict, self).__delitem__(self,
>> self._transformer(key))
Somehow I feared that this would happen.
> In defaultdict, I w
The software you used to post this message wrapped some of the lines of
code. For example:
> def __delitem__(self, key):
> super(keytransformdict, self).__delitem__(self,
> self._transformer(key))
In defaultdict, I wonder whether everything should be viewed as a
factory:
def setde
Hello,
in follow-up to the recent "dictionary accumulator" thread, I wrote a
little module with several subclassed dicts.
Comments (e.g. makes it sense to use super), corrections, etc.? Is this
PEP material?
Docstrings, Documentation and test cases are to be provided later.
mfg
Georg
-
13 matches
Mail list logo