Velocity Reviews - Computer Hardware Reviews

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

Thread Tools

cymbalic reference?

Posts: n/a
I have this working and I am curious to know how others do same.

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

urls = {'Abc':''}
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__

Reply With Quote

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 09:06 PM
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