[Python-3000] pre-PEP: Default Argument Expressions
jcarlson at uci.edu
Wed Feb 14 08:27:39 CET 2007
Chris Rebert <cvrebert at gmail.com> wrote:
> Requesting comments on the following pre-PEP. pybench runs both with and
> without the patch applied would also be appreciated.
> - Chris R
One Glyph Lefkowitz posted today  in response to dynamic attribute
access the following, which is surely applicable here.
> I also strongly dislike every syntax that has thus far been proposed,
> but even if I loved them, there is just no motivating use-case. New
> syntax is not going to make dynamic attribute access easier to
> understand, and it *is* going to cause even more version-compatibility
> I really, really wish that every feature proposal for Python had to meet
> some burden of proof, or submit a cost/benefit analysis. Who is this
> going to help? How much is this going to help them? "Who is this going
> to hurt" is easy, but should also be included for completeness -
> everyone who wants to be able to deploy new code on old Pythons.
> I suspect this would kill 90% of "hey wouldn't this syntax be neat"
> proposals on day zero, and the ones that survived would be a lot more
> interesting to talk about.
Replace "dynamic attribute access" with "default argument expressions".
With that said, please provide:
1a) Proof as to what is to be gained over an explicit if statement or
1b) A cost/benefit analysis of the time it would take to "fix" the
standard library and/or user code with any of the provided new
2) Who is this going to help (and do we care)?
3) How much is this going to help them?
4) Who is this going to hurt (in addition to everyone who wants to run
new code in older Pythons)?
As stated by most repondents to the original threads, a conditional
statement is generally preferable (which answers #1a). It is really
only going to help new users of Python (as seasoned users don't have the
issue, and generally don't seem to mind using an additional line to
"solve" the "problem") (which answers #2). It isn't going to help very
many people terribly much - 2 line addition and 1 line modification *in
the worst case*, if you include a new None-like sentinal (which answers
#3). Further, it's going to hurt everyone who is used to the 'execute
once' default argument semantics currently in place (which answers #4).
Using Glyph's requirements, we see that the syntax is just not
worthwhile, as stated by most people in the original thread.
More information about the Python-3000