Huy Ton That
huyslogic at gmail.com
Wed Aug 4 22:32:02 CEST 2010
I have a side question,
I am using python 2.7.
Why do you use class A: instead of class A(object): ?
On Wed, Aug 4, 2010 at 4:08 PM, bob gailer <bgailer at gmail.com> wrote:
> On 8/4/2010 4:04 PM, bob gailer wrote:
>> On 8/4/2010 3:44 PM, Huy Ton That wrote:
>>> Oh, that's right, I should have tried to example in the interpreter
>>> instead of in my head:P
>>> Say Bob,
>>> Is that the preferred method over something like:
>> I would prefer to create a class and make these functions class methods.
>> class A:
>> def output_text(self, data):return data
>> def output_hex(self, data):return '\\x' + data
>> def __getattr__(self, name):
>> return self.output_text
>> a = A()
>> print a.output_text(data)
>> print a.output_hex(data)
>> print a.foo(data)
>> I just realized my answer does not accomodate your looking for the
> function by name. Please stand by....
> Bob Gailer
> Chapel Hill NC
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor