I have a side question, I am using python 2.7.
Why do you use class A: instead of class A(object): ? -Huy On Wed, Aug 4, 2010 at 4:08 PM, bob gailer <bgai...@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() >> data='bar' >> 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 > 919-636-4239 > Chapel Hill NC > >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor