Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: cymbalic reference? (http://www.velocityreviews.com/forums/t956593-re-cymbalic-reference.html)

Terry Reedy 01-17-2013 12:30 AM

Re: cymbalic reference?
 
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



All times are GMT. The time now is 05:05 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.