[Tutor] Function Programming Style
by Kai Weber other posts by this author
Jun 30 2003 3:56PM messages near this date
Re: [Tutor] writing a search engine
|
RE: [Tutor] Function Programming Style
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@[...].de
web http://www.glorybox.de
pgp 0x594D4132
_______________________________________________
Tutor maillist - Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
|