common practice for creating utility functions?
John Salerno
johnjsal at NOSPAMgmail.com
Mon May 15 14:26:01 EDT 2006
Just a quickie for today: Is it common (and also preferred, which are
two different things!) to create a function that has the sole job of
calling another function?
Example: for fun and exercise, I'm creating a program that takes a quote
and converts it into a cryptogram. Right now I have four functions:
convert_quote -- the main function that starts it all
make_code -- makes and returns the cryptogram
make_set -- called from make_code, converts the quote into a set so each
letter gets only one coded letter
test_sets -- makes sure a letter isn't assigned to itself
So my first question is this: should I make a Cryptogram class for this,
or are functions fine? If the latter, then back to my original point:
can I do something like this:
def convert_quote(quote):
return make_code(quote)
Or does it not make sense to have a function just call another function?
More information about the Python-list
mailing list