ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
[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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved