On 1/16/2013 4:06 PM, rh wrote:
My final product uses your suggestions along with one from the other post.
I like the idea of storing the class name as the key. Then no call to globals()
is needed. But I still have to test how that object behaves when it's a key.
i.e. Is it deeply bound? Shallow? Tight? Loose? Not sure which is the correct
term!
The only effect on an object of making it a dict key is that it cannot
disappear.
class C: pass
d = {C: 'C'}
del C
# The name 'C' can no longer be used to access the class
# However, the class cannot be deleted because it is in use
for c in d: print(c)
So maybe I want {Abc:'http://example.com'} and o = s() instead.
Yes, as I suggested.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list