Optional parameter object re-used when instantiating multiple objects
George Sakkis
george.sakkis at gmail.com
Sun Nov 16 15:30:51 EST 2008
On Nov 16, 2:30 pm, "Chris Rebert" <c... at rebertia.com> wrote:
> On Sun, Nov 16, 2008 at 11:02 AM, George Sakkis <george.sak... at gmail.com> wrote:
> > On Nov 16, 8:28 am, Steve Holden <st... at holdenweb.com> wrote:
>
> >> "Less obvious" is entirely in the mind of the reader.
>
> > Without documentation or peeking into the function body, a None
> > default conveys little or no information, so I don't think it's just
> > in the mind of the reader. Do you find the following less obvious than
> > the current workaround ?
>
> > from datetime import date
> > from timedelta import timedelta
>
> > def make_reservation(customer,
> > checkin=`date.today()`,
> > checkout=`checkin+timedelta(days=3)`):
> > ...
>
> >> However I can see
> >> far more justification for the behavior Python currently exhibits than
> >> the semantic time-bomb you are proposing.
>
> > I didn't propose replacing the current behavior (that would cause way
> > too much breakage), only adding a new syntax which is now invalid, so
> > one would have to specify it explicitly.
>
> Minor FYI, but Guido has proscribed backticks ever being used in
> Python again. Seehttp://www.python.org/dev/peps/pep-3099/
I know, just used it for the sake of the example; the actual syntax is
much less of an issue in this case than the functionality.
George
More information about the Python-list
mailing list