On 10/09/2013 04:26 PM, Georg Brandl wrote:
I realize you are -1 on the proposal in general, but I'd be very interested if
you could propose an alternate approach where I didn't need "a new spelling for
None" as you put it.
I think I would make Steven's proposed syntax mandatory: let the implementor
of the function decide which value stands for "not given" -- just like we do
in the C version, BTW.

But that's not how addch works. addch counts how many arguments it received; if it is called with one or two, it does one thing, and if it's called with three or four it does something else. You can't duplicate these semantics with

Similarly, you can't accurately express the semantics of range's arguments using default values. PyPy's approach is approximately like this:

   def range(x, y=None, step=None):
        step = 1 if step is None else step
        if y is not None:
            start, stop = x, y
        else:
            start, stop = 0, x

But now introspection information on range() is inaccurate and unhelpful. (Not to mention, they allow specifying step without specifying y, by using keyword arguments.)

My goal in writing the PEP was to codify existing practice, which meant reflecting these (annoying!) corner cases accurately.


//arry/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to