'mapping' in weakrefs unneeded?

Andrew Dalke dalke at acm.org
Mon Apr 9 20:57:27 EDT 2001


I wrote in message <9amdk2$82i$1 at slb0.atl.mindspring.net>...
>(Repost from a mail I sent to python-dev
>http://mail.python.org/pipermail/python-dev/2001-March/01
>which garnered no reponse.  Anyone here want to ignore it :)

I guess that would be a "yes to all".

Last call!

>  I'm starting to learn how to use weakrefs.  I'm curious
>about the function named 'mapping'.  It is implemented as:
>
>> def mapping(dict=None,weakkeys=0):
>>     if weakkeys:
>>         return WeakKeyDictionary(dict)
>>     else:
>>         return WeakValueDictionary(dict)
>
>Why is this a useful function?  Shouldn't people just call
>WeakKeyDictionary and WeakValueDictionary directly instead
>of calling mapping with a parameter to specify which class
>to construct?
>
>If anything, this function is very confusing

 [...]

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list