Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16980
| References | <4EE48AB3.7070807@gmail.com> |
|---|---|
| Date | 2011-12-11 22:15 +1100 |
| Subject | Re: Verbose and flexible args and kwargs syntax |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3510.1323602145.27778.python-list@python.org> (permalink) |
On Sun, Dec 11, 2011 at 9:49 PM, Eelco Hoogendoorn
<hoogendoorn.eelco@gmail.com> wrote:
> Problems im still wrestling with: the same syntax could not be used when
> calling a function; that lack of symmetry would make things more confusing,
> not less.
That symmetry is a large factor, IMHO. I can write a wrapper function like this:
def fixedargs(x,y,z):
return wrappedfunc(x,y,z)
Or like this:
def anyargs(*args,**kwargs):
return wrappedfunc(*args,**kwargs)
Either way, it's a perfect parallel, and that's very useful for noticing errors.
With a keyworded syntax, that's going to be a lot harder.
Another issue: You suggest being able to use "attrdict" or some other
dict subclass. This means that, rather than being a language
construct, this will involve a name lookup. And what happens if you
have a class that subclasses both list and dict? Will it get the
positional args, the keyword args, or both?
Laudable notion, but I'm not sure that it'll actually work in practice.
ChrisA
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Verbose and flexible args and kwargs syntax Chris Angelico <rosuav@gmail.com> - 2011-12-11 22:15 +1100
Re: Verbose and flexible args and kwargs syntax Duncan Booth <duncan.booth@invalid.invalid> - 2011-12-11 12:39 +0000
Re: Verbose and flexible args and kwargs syntax Chris Angelico <rosuav@gmail.com> - 2011-12-12 00:09 +1100
Re: Verbose and flexible args and kwargs syntax Christian Heimes <lists@cheimes.de> - 2011-12-11 14:14 +0100
csiph-web