Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16980

Re: Verbose and flexible args and kwargs syntax

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'wrapper': 0.07; 'args,': 0.09; 'dict': 0.09; 'imho.': 0.09; 'positional': 0.09; 'subclasses': 0.09; 'def': 0.13; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; 'factor,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function;': 0.16; 'issue:': 0.16; 'parallel,': 0.16; 'subject:syntax': 0.16; 'syntax': 0.16; 'this:': 0.16; 'language': 0.17; 'wrote:': 0.18; 'suggest': 0.20; 'dec': 0.22; 'header:In- Reply-To:1': 0.22; 'keyword': 0.24; "i'm": 0.26; 'function': 0.27; 'message-id:@mail.gmail.com': 0.28; 'pm,': 0.29; 'class': 0.29; 'sun,': 0.30; 'syntax,': 0.30; 'list': 0.32; 'actually': 0.33; 'rather': 0.33; 'that,': 0.33; 'to:addr:python-list': 0.34; 'things': 0.34; 'calling': 0.34; 'but': 0.37; 'received:google.com': 0.37; 'another': 0.37; 'problems': 0.37; 'could': 0.37; 'some': 0.38; 'received:209.85': 0.38; 'useful': 0.38; 'either': 0.39; 'being': 0.39; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'happens': 0.40; 'more': 0.61; '2011': 0.61; 'perfect': 0.64; '11,': 0.68; 'symmetry': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=gO+MEIV3rbehfvhSARwSvxjFIO6Qr3vWgJhGEFWdK2c=; b=YGJt35CNEE7v+jNpmT2Ef7/2Ftj9brU+JBVWXULW2+ZHbEP4+d0UE1jKz6YiIY/rHH rvGmzSlxcxIyPnjFuPp+cqhIgrF5blz4laU+Bp5fQDfE3Cl7ToAsj0suSEmYrTDYTv2O +K7ELbL1Bd/R5DmToIld3p3EXQoThmYuYTtZQ=
MIME-Version 1.0
In-Reply-To <4EE48AB3.7070807@gmail.com>
References <4EE48AB3.7070807@gmail.com>
Date Sun, 11 Dec 2011 22:15:41 +1100
Subject Re: Verbose and flexible args and kwargs syntax
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3510.1323602145.27778.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323602145 news.xs4all.nl 6886 [2001:888:2000:d::a6]:35615
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16980

Show key headers only | View raw


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 | NextNext in thread | Find similar | Unroll thread


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