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 provided
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 and
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:
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
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 __init__ ,
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 thirdpartdict requires a
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
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
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 wonder
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
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 approach more
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
13 matches
Mail list logo