Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: cymbalic reference?

Reply
Thread Tools

Re: cymbalic reference?

 
 
Terry Reedy
Guest
Posts: n/a
 
      01-17-2013
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: cymbalic reference? rh Python 0 01-16-2013 08:52 PM
Re: cymbalic reference? Terry Reedy Python 0 01-16-2013 05:23 AM
Re: cymbalic reference? Benjamin Kaplan Python 0 01-16-2013 05:08 AM
Re: cymbalic reference? Chris Angelico Python 0 01-16-2013 05:03 AM
cymbalic reference? rh Python 0 01-16-2013 04:56 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57