[Python-ideas] proto-PEP: Fixing Non-constant Default Arguments

Josiah Carlson jcarlson at uci.edu
Wed Jan 31 02:35:08 CET 2007


"Jan Kanis" <jan.kanis at phil.uu.nl> wrote:
> 
> On Tue, 30 Jan 2007 23:31:36 +0100, Josiah Carlson <jcarlson at uci.edu>  
> wrote:
> > Roman Susi <rnd at onego.ru> wrote:
> >>
> >>     def foo(x, y, z, bar=, qux=):
> >>         if baz is Missing:
> >>             baz = []
> >>         #code
> >>
> >> at least, it doesn't require decorators, is backward compatible
> >> (hopefully no grammar conflicts in there), reads as English.
> >
> > The above with a missing value for a default *is not* backwards
> > compatible with previous Pythons.  New syntax is, by definition, not
> > backwards compatible.
> >
> >  - Josiah
> 
> As a matter of fact, backward-compatible syntax changes are certainly  
> possible. (ever wondered how C++ got it's syntax?) Any valid current  
> python is still going to behave exactly the same if this syntax were to be  
> accepted. Talking about backward compatibility, I think it is safe to  
> ignore any text files that don't get accepted by the python interpreter.  
> This syntax change would certainly not break any existing production  
> python code.
> (note: the above statements do not entail in any way that I am in favour  
> of this syntax change)

Fowards compatible then.  That is to say, writing for the new proposed
system will break compatibility with older Pythons.  On the other hand,
using currently-available language syntax and semantics is compatible
among the entire range of Pythons available today.


 - Josiah




More information about the Python-ideas mailing list