Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36919 > unrolled thread

Re: cymbalic reference?

Started byTerry Reedy <tjreedy@udel.edu>
First post2013-01-16 19:30 -0500
Last post2013-01-16 19:30 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: cymbalic reference? Terry Reedy <tjreedy@udel.edu> - 2013-01-16 19:30 -0500

#36919 — Re: cymbalic reference?

FromTerry Reedy <tjreedy@udel.edu>
Date2013-01-16 19:30 -0500
SubjectRe: cymbalic reference?
Message-ID<mailman.583.1358382627.2939.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web