[Python-3000] PEP 3124 - more commentary

Nick Coghlan ncoghlan at gmail.com
Tue May 15 11:28:54 CEST 2007

Guido van Rossum wrote:
> On 5/14/07, Phillip J. Eby <pje at telecommunity.com> wrote:
>> More importantly, it seems to go against the grain of at least my
>> mental concept of Python call signatures, in which arguments are
>> inherently *named* (and can be passed using explicit names), with
>> only rare exceptions like range().  In contrast, the languages that
>> have this sort of positional thing only allow arguments to be
>> specified by position, IIRC.  That's what makes me uncomfortable with it.
> Well, in *my* metnal model the argument names are just as often
> irrelevant as they are useful. I'd be taken aback if I saw this in
> someone's code: open(filename="/etc/passwd", mode="r"). Perhaps it's
> too bad that Python cannot express the notion of "these parameters are
> positional-only" except very clumsily.

The idea of positional-only arguments came up during the PEP 3102 
discussions. I believe the proposal was to allow a tuple of annotated 
names instead of a single name for the varargs parameter:

def range(*(start:int, stop:int, step:int)):
     ...  # implement xrange

def range(*(stop:int,)):
     return range(0, x, 1)

def range(*(start:int, stop:int)):
     return range(x, y, 1)

PJE's approach (using *args in the base signature, but allowing 
overloads to omit it) is probably cleaner, though.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-3000 mailing list