decorat{or,ion}

Mike McClain mike.junk.46 at att.net
Fri May 18 21:31:16 EDT 2018


    Let's say I want something that does most or all of foo's
functionality plus a little more and maybe tweek some of foo's
output, so I write a wrapper around foo and call it bar.
If inside bar are the call to foo, as well as methods baz(),
buz() and bug() that make their magic and bar ends up performing
as I want.

    If I understood correctly baz(), buz() and bug() plus the glue
that is bar are decorations around foo or bar is a decorator of foo.

    Apologies, I don't yet know how to show that foo and bar are
meant to be objects. I wrote my first fortran program in the 1960's
but this is my first attempt to delve into the world of OOP. At the
moment this world view feels like I imagine a grasshopper sees the
world through a miriad of lenses.

    For that matter, are baz(), buz() and bug() methods if they only
help bar get the job done but don't have a place in bar's interface?

Thanks again,
Mike
--
"Keep active but don't be afraid to occasionally indulge."
    - Jeralean Talley, America's oldest living woman



More information about the Python-list mailing list