is there any principle when writing python function
harrismh777
harmar at member.fsf.org
Sun Aug 28 00:51:59 EDT 2011
smith jack wrote:
> i have heard that function invocation in python is expensive, but make
> lots of functions are a good design habit in many other languages, so
> is there any principle when writing python function?
> for example, how many lines should form a function?
Once Abraham Lincoln was asked how long a man's legs should be. (Well,
he was a tall man and had exceptionally long legs... his bed had to be
specially made.)
Old Abe said, "A man's legs ought to be long enough to reach from his
body to the floor".
One time the Austrian Emperor decided that one of Wolfgang Amadeus
Mozart's masterpieces contained too many notes... when asked how many
notes a masterpiece ought to contain it is reported that Mozart
retorted, "I use precisely as many notes as the piece requires, not one
note more, and not one note less".
After starting the python interpreter import this:
import this
... study carefully. If you're not Dutch, don't worry if some of it
confuses you. ... apply liberally to your function praxis.
kind regards,
--
m harris
FSF ...free as in freedom/
http://webpages.charter.net/harrismh777/gnulinux/gnulinux.htm
More information about the Python-list
mailing list