[Tutor] do_it()

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Thu Dec 11 14:39:17 EST 2003


hi Eddie,

Wow you are right, I had no idea a function could return two
lists.  So yes, you could then reduce everything to just one function
instead of writing a class.  From what I've read though, OO is superior to
writing functions because you are then able to:

1) model your problem better
2) reuse code
3) ultimately spend less time finding the best solution

I hope that helps you.

On Thu, 11 Dec 2003, Edward Comber wrote:

> Fair enough, but you could have kept the list of words external to the
> functions and used by both.
>
> Also you can return two lists like...
>
> def stop_n_go_words(terms):
> 	blah
> 	return stop_list, go_list
>
> a_stop_list, a_go_list = stop_n_go_words(terms)
>
>




More information about the Tutor mailing list