Isn't there a better way?
Bruno Desthuilliers
onurb at xiludom.gro
Fri Jul 21 14:27:10 EDT 2006
T wrote:
> I am using an optparse to get command line options, and then pass them
> to an instance of another class:
>
>
>
> # Class that uses optparse.OptionParser
> foo = Parse_Option()
>
> # Class that does the real work
> bar = Processor()
>
> bar.index = foo.options.index
> bar.output = foo.options.output
> bar.run()
>
> This works, but it feels hokey or unnatural to "pass" data from one
> class to another. Isn't there a better way???
What's wrong with:
foo = Parse_Option()
bar = Processor()
bar.run(foo.options.index, foo.options.output)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list