Can anyone volunteer to help with a Python 2.5 / Python 2.4 code issue?

Toshio Kuratomi a.badger at gmail.com
Fri May 1 20:49:04 UTC 2009


Jeff Spaleta wrote:
> On Fri, May 1, 2009 at 12:23 PM, Toshio Kuratomi <a.badger at gmail.com> 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.  I dont
> see that going on in the code so it looks to me like defaultdict can
> just be replaced with dict with no pain  defaultdict=dict
> 
I think you'll get exceptions at places like this when just replacing
defaultdict with dict::

http://git.fedoraproject.org/git/triage.git?p=triage.git;a=blob;f=triageweb/fedoratriage/controllers.py;h=dbd62ecbea1fd7cf1909c23ef894c1039f13b71a;hb=HEAD#l114

-Toshio

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/fedora-python-devel-list/attachments/20090501/153ee94d/attachment.sig>


More information about the Fedora-python-devel-list mailing list