class A:
def call_by_name(self, func, data):
f = A.__dict__.get(func, self.output_text)
return f(data)
def output_text(self, data):return data
def output_hex(self, data):return '\\x' + data
a = A()
data = 'bar'
print a.call_by_name('output_text', data)
print a.call_by_name('output_hex', data)
print a.call_by_name('foo', data)
--
Bob Gailer
919-636-4239
Chapel Hill NC
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor