"""
Learning about Decorators
"Just for the fun of it" -- OCN

Decorators as Abductors

I'm thinking in terms of a specific (aborted) TV series,
but the pattern:

me = Abduct(me)  # @Abduct a callable

has generic resonance as a metaphor.

Specifically:

http://en.wikipedia.org/wiki/Invasion_%28TV_series%29

Storyline (from imdb.com)

In the aftermath of a hurricane, a Florida Park Ranger and his family
deal with strange occurrences, including luminescent creatures in
the water and people that somehow seem to have changed after
surviving the night of the disaster out in the open. Written by Anonymous

Wikipedia:

In Bulgaria, Invasion premiered on February 21, 2007,
on Nova Television and in Romania it premiered on
March 10, 2009, on Pro Cinema movie channel.

OUTPUT:

She loves her babies.
She loves her babies (not!).

"""

def Floridian(s):  # this all happens in Florida
    return s

# BEFORE:

print( Floridian("She loves her babies."))

def Alien(f): # A is for Abduction
    """luminiscent creature in the water"""
    def FauxFloridian(s): # a clone
        return s[:-1] + " (not!)." # a change
    return FauxFloridian

@Alien
def Floridian(s):  # same function
    return s

# AFTER:

# she = Dr. Mariel Underlay
print( Floridian("She loves her babies."))
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
https://mail.python.org/mailman/listinfo/edu-sig

Reply via email to