[Python-talk] Speaking of oops. How to call a method in another class in another file?
Kent Johnson
kent37 at tds.net
Tue Jul 28 22:53:21 EDT 2009
On Tue, Jul 28, 2009 at 4:32 PM, <bruce.labitt at autoliv.com> wrote:
>> > Do I need to do something like
>> >
>> > class Xambig:
>> > def __init__(self):
>> > # initialization stuff here... then
>> > myfile = "ambig.dat"
>> > myrange = 200.00
>> > self.plotme = plotMe(myfile, myrange)
>> >
>> >
>>
>> Yes, you could do that sort of initialization stuff in __init__, if you
>> wanted your object to default to having those values.
>>
>> LArry
>>
>
> What if I don't want these defaults, but always want it passed from the
> outside?
Then maybe you don't want a class at all. It sounds like plotMe()
should just be a plain function, not a member function.
Python functions don't have to be in a class.
Kent
More information about the Python-talk
mailing list