[ python-Bugs-1297986 ] hashable and mutable functions
SourceForge.net
noreply at sourceforge.net
Wed Sep 21 19:55:31 CEST 2005
Bugs item #1297986, was opened at 2005-09-21 17:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1297986&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: ChristianJ (cybb20)
Assigned to: Nobody/Anonymous (nobody)
Summary: hashable and mutable functions
Initial Comment:
It is not easy to check if an object is hashable, ie
hasattr(list(), '__hash__') -> True
try: hash(list())
except TypeError: pass
seems to be a possible way to see if an object is
hashable, however it is not satisfiable that this
information needs to be retrieved by using exception
handling.
My proposal:
There should be a hashable(obj) function returning a
bool object and additionally it would be nice to have
something like ismutable(obj) function, possibly as
built-in functions.
Reason:
callable() is a built-in function and returns
information about an object whether it's callable or
not, that is a basic info about this object.
If an object is hashable or mutable is a state of an
object that is also very important to know.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1297986&group_id=5470
More information about the Python-bugs-list
mailing list