Nick Coghlan wrote:
> Guido van Rossum wrote:
>> Here's a related but more complicated wish: define a function in such
>> a way that certain parameters *must* be passed as keywords, *without*
>> using *args or **kwds. This may require a new syntactic crutch.
> 
> A single '*' could indicate that no additional positional arguments were 
> permitted.
> 
> def f(*, paramA, paramB=10):
>    print paramA, paramB
> 
> Here paramA and paramB can only be passed as keywords, and paramA *has* to be 
> passed as it has no default.
> 
> Utterly magical to anyone not already familiar with the use of *args, though.

A different idea from another part of the thread would be to allow a parameter 
list rather than an identifier after **:

   def f(**(paramA, paramB=10)):
       print paramA, paramB

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to