Re: cymbalic reference?

Discussion in 'Python' started by Terry Reedy, Jan 17, 2013.

  1. Terry Reedy

    Terry Reedy Guest

    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
    Terry Reedy, Jan 17, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rh

    cymbalic reference?

    rh, Jan 16, 2013, in forum: Python
    Replies:
    0
    Views:
    128
  2. Chris Angelico

    Re: cymbalic reference?

    Chris Angelico, Jan 16, 2013, in forum: Python
    Replies:
    0
    Views:
    150
    Chris Angelico
    Jan 16, 2013
  3. Benjamin Kaplan

    Re: cymbalic reference?

    Benjamin Kaplan, Jan 16, 2013, in forum: Python
    Replies:
    0
    Views:
    137
    Benjamin Kaplan
    Jan 16, 2013
  4. Terry Reedy

    Re: cymbalic reference?

    Terry Reedy, Jan 16, 2013, in forum: Python
    Replies:
    0
    Views:
    127
    Terry Reedy
    Jan 16, 2013
  5. rh

    Re: cymbalic reference?

    rh, Jan 16, 2013, in forum: Python
    Replies:
    0
    Views:
    145
Loading...

Share This Page