On Fri, 2009-05-01 at 12:36 -0800, Jeff Spaleta wrote:
> On Fri, May 1, 2009 at 12:23 PM, Toshio Kuratomi <[email protected]> wrote:
> > Python-2.4 does have "setdefault" which is a misleading name (it doesn't
> > "set" a "default") for something that can be made to replace defaultdict
> > sometimes.
> >
> > Here's an example of making a replacement in python-fedora:
> > http://bzr.fedorahosted.org/bzr/python-fedora-python-fedora-devel?cmd=revision;rev=397
> >
> > Usually, if I was going to rewrite some code, I'd use a try: except: as
> > it's clearer what's going on.  Here's an example:
> 
> I just try: except: the import.
> 
> What's not clear to me is why defaultdict is needed at all in this
> case.  There is no call to default_factory  and its default_factory
> which lets you define a default value when a key is missing.

The value or callable passed to the constructor sets it.

-- 
Ignacio Vazquez-Abrams <[email protected]>

PLEASE don't CC me; I'm already subscribed

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Fedora-python-devel-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/fedora-python-devel-list

Reply via email to