From: Kjersti Berg Date: 2007-04-18T02:53:13+09:00 Subject: Re: how to have a default argument ------=_Part_27893_11006737.1176832389095 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 17/04/07, shawn bright wrote: > > hello all, > > i have a function that sometimes needs to be passed a variable, but > sometimes not. > > def get_some_records(year) > get records for year > process them > return result > end > > the thing is, i already have it written, but i would like to have a > default > like if get_some_records() is called, year would be assumed to be 2007 > > is there a way i can do this without having to change everywhere it is > called in my code? Hi If I understand you correctly, you could do this: def get_some_records(year='2007') get records for year process return end year will be set to 2007 if no parameter is given. Kjersti ------=_Part_27893_11006737.1176832389095--