[Tutor] Function Programming Style
Kai Weber
lists@glorybox.de
Mon Jun 30 12:37:23 2003
Hi,
my first bigger Python program led me think about the following problem:
I have to set informations and defined appropriate get and
set-functions eg. set_title, get_title, set_date, get_date. Now I
wonder, what to do, if I have to do something with the arguments passed
to the function. Maybe then a function like set(what, value) would be
better?
def set_title(value):
modify(value)
title = value
def set_date(value):
modify(value)
title = value
VS:
def set(what, value)
modify(value)
if what==title
title = value
elif what==date
date = value
Regards, Kai
--
* mail kai.weber@glorybox.de
web http://www.glorybox.de
pgp 0x594D4132