cymbalic reference?

R

rh

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__
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top