[Python-Dev] Pre-PEP: Exception Reorganization for Python 3.0

Fred L. Drake, Jr. fdrake at acm.org
Sat Jul 30 05:38:10 CEST 2005


On Friday 29 July 2005 23:07, Robert Brewer wrote:
 > >     +-- WeakReferenceError (rename for ReferenceError)
 >
 > This also has a LookupError feel to it.

I disagree.

LookupError is used when looking for an object within some containing object 
according to some sort of key (dict key, index, etc.).  It's usually a 
reasonable expectation that there might not be an object associated with that 
key.  You also know that a different object may be returned at different 
times; you care about the association of the object with the key.

For weak references, you're not using a key in a container, you're resolving a 
specific reference that you know exists; what you don't know is whether the 
object still exists.  There's no indirection through a key as there is for 
LookupError.

I'm +0 on the WeakReferenceError name, but -1 on making it a subclass of 
LookupError.


  -Fred

-- 
Fred L. Drake, Jr.   <fdrake at acm.org>


More information about the Python-Dev mailing list