cymbalic reference?

Discussion in 'Python' started by rh, Jan 16, 2013.

  1. rh

    rh Guest

    I have this working and I am curious to know how others do same.

    class Abc(object):
    def __init__(self):
    pass
    def good(self):
    print "Abc good"
    def better(self):
    print "Abc better"

    urls = {'Abc':'http://example.com'}
    strings = ['good', 'better']

    for s in urls:
    o = eval("%s()" % s)
    for string in strings:
    eval("o.%s()" % string)


    Yes, 'spose symbolic references is what these are....

    While I'm at it what magic could I use to print "the-class-I-am-in good"
    instead of hard-coding "Abc good"? I tried __class_ and self.__class__
     
    rh, Jan 16, 2013
    #1
    1. Advertisements

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. Darren
    Replies:
    0
    Views:
    635
    Darren
    Oct 11, 2004
  2. Dude
    Replies:
    0
    Views:
    475
  3. ce
    Replies:
    1
    Views:
    3,161
  4. sam pal
    Replies:
    3
    Views:
    752
    E. Robert Tisdale
    Jul 16, 2003
  5. Craig Nicol
    Replies:
    2
    Views:
    604
    Craig Nicol
    May 10, 2004
  6. Marc
    Replies:
    6
    Views:
    894
    Denis Remezov
    Jul 6, 2004
  7. aurora
    Replies:
    6
    Views:
    568
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Oct 18, 2004
  8. mrstephengross
    Replies:
    2
    Views:
    495
    mrstephengross
    Sep 7, 2005
Loading...