In article <[EMAIL PROTECTED]>, "Guido van Rossum" <[EMAIL PROTECTED]> wrote:
> On 5/2/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Terry Reedy wrote: > > > > > my way to call your example (given the data in separate variables): > > > make_person(name, age, phone, location) > > > your way: > > > make_person(name=name, age=age, phone=phone, location = location) > > > > For situations like that, I've sometimes thought > > it would be useful to be able to say something like > > > > make_person(=name, =age, =phone, =location) > > And even with Terry's use case quoted I can't make out what you meant > that to do. I'm pretty sure he wants it to mean: make_person(name=name, age=age, phone=phone, location=location). In other words it's a shortcut to avoid needless repetition. Personally I'd like some way to do that, but the initial "=" is pretty startling at first glance. Not that I have a better suggestion. As far as the rest of the thread goes (and I may be late to the party on this), I personally would *love* to be able to write: def func(arg0, arg1, *args, key1=def1) and force key1 to be specified by name. I've coded this before using **kargs for the keyword-only args, but I'd much rather be able to list them in the def (making it more self-documenting). But that's as far as I'd take it. I don't see the point to keyword-only arguments that do not have default values. And I don't think it's worth the potential confusion to allow keyword-only args after a fixed # of positional args. The proposed syntax reads like exactly the wrong thing to me; "|" as a separator might do if one is desperate enough for this feature, i.e.: def foo(arg0, arg1 | karg=None): -- Russell _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com