Skip to content

Instantly share code, notes, and snippets.

@jldupont
Created February 4, 2012 16:50
Show Gist options
  • Save jldupont/1738884 to your computer and use it in GitHub Desktop.
Save jldupont/1738884 to your computer and use it in GitHub Desktop.
pyfnc example 1
from pyfnc import patterned, pattern
@pattern('male', str)
def greet_male(p1, p2):
return "Hello M. %s!" % p2
@pattern('female', str)
def greet_female(p1, p2):
return "Hello Mrs. %s!" % p2
@patterned
def greet(p1, p2):
pass
print greet("male", "Dupont")
"Hello M. Dupont!"
print greet("female", "Corriveau")
"Hello Mrs. Corriveau!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment