Chocolate [was Re: Python Books for 2002]

Emile van Sebille emile at fenx.com
Wed Apr 11 22:38:51 EDT 2001


But wouldn't it just as likely then be:

person.be_consumed_by(substance)

--

Emile van Sebille
emile at fenx.com

---------
"Greg Ewing" <greg at cosc.canterbury.ac.nz> wrote in message
news:3AD50BB3.E71891A2 at cosc.canterbury.ac.nz...
> Ben Wolfson wrote:
> >
> > from Animals.Mammals import Human
> >
> > hungry_person = Human()
> >
> > So that the hungry_person can .consume() the comestibles.
>
> But the method of consumption depends on the class
> of the substance, so dispatching on it seems
> appropriate. Perhaps
>
>   substance.be_consumed_by(person)
>
> Then in the future one could define additional
> classes of substance such as Cocaine and Heroin
> and the code will continue to work.
>
> --
> Greg Ewing, Computer Science Dept, University of Canterbury,
> Christchurch, New Zealand
> To get my email address, please visit my web page:
> http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list