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


Groups > comp.lang.python > #84489

Re: Alternative to multi-line lambdas: Assign-anywhere def statements

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jeanpierreda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'assign': 0.07; 'assignment': 0.07; 'assigning': 0.09; 'item,': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'def': 0.12; 'jan': 0.12; '24,': 0.16; 'attribute,': 0.16; 'dictionary,': 0.16; 'lambda': 0.16; 'normally,': 0.16; 'obviously,': 0.16; 'subject:def': 0.16; 'subscripted': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'then.': 0.30; 'message- id:@mail.gmail.com': 0.30; 'that.': 0.31; 'sense': 0.34; 'maybe': 0.34; 'received:google.com': 0.35; 'really': 0.36; 'yield': 0.36; 'represent': 0.38; 'even': 0.60; 'easy': 0.60; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'nobody': 0.68; '2015': 0.84; 'actually,': 0.84; 'subject:Alternative': 0.84; 'do:': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=QblxMWhrpBwdWO+cku27Vwe9HrDCLYiB7RpwD6abVAw=; b=cROUlj0XU+h/zNKybrWb7Yg7CYaSQmI/AwByYaA1TE26wFFljg6ke8jQTyGc2Ce7h2 Ik8i9VV3Feba4x4iyoVZ9qQCG0XhnlH39Ri0S4aON3yvuO9Sty80EnR7S8g/emijHQRQ vEtiDYJHrzAQVzRjObZUPiWHWOnK/Q/rytuCa1Fws1RiTMZkTFKqnRtr3MqWYVIf6Jmt i3Pj8TwfptYGjwU5pmHT/ZE8FbHgtCYk3dSvq7/hNWe5umQp/8K2J2v4pM2kBFa9sQ7C IqSzA455GFuMnTtsi+XjTh+PRfL5pJPL3fxtZjVAQNhzyrBP1Jrb0V/IH3OAmUaCZGdK ou5g==
X-Received by 10.140.38.139 with SMTP id t11mr26122325qgt.83.1422131743754; Sat, 24 Jan 2015 12:35:43 -0800 (PST)
MIME-Version 1.0
In-Reply-To <CAPTjJmohdQbK9_ikh8heaMRbpJ270UW6C1AE2oNVgV_4AoYfQg@mail.gmail.com>
References <CAPTjJmrAQgtauH74dwCzb_-6T09D0dLVkxiGrAxJMp_OOwgS0g@mail.gmail.com> <54C3EAD1.2010501@stoneleaf.us> <CAPTjJmohdQbK9_ikh8heaMRbpJ270UW6C1AE2oNVgV_4AoYfQg@mail.gmail.com>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date Sat, 24 Jan 2015 12:35:03 -0800
Subject Re: Alternative to multi-line lambdas: Assign-anywhere def statements
To Chris Angelico <rosuav@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18096.1422131746.18130.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1422131746 news.xs4all.nl 2837 [2001:888:2000:d::a6]:55029
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84489

Show key headers only | View raw


On Sat, Jan 24, 2015 at 11:55 AM, Chris Angelico <rosuav@gmail.com> wrote:
> That's still only able to assign to a key of a dictionary, using the
> function name. There's no way to represent fully arbitrary assignment
> in Python - normally, you can assign to a name, an attribute, a
> subscripted item, etc. (Augmented assignment is a different beast
> altogether, and doesn't really make sense with functions.) There's no
> easy way to say "@stash(dispatch_table_a['asdf'])" and have that end
> up assigning to exactly that.

Obviously, nobody will be happy until you can do:

def call(*a, **kw): return lambda f: f(*a, **kw)

@call()
def x, y ():
    yield 1
    yield 2

Actually, maybe not even then.

-- Devin

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Alternative to multi-line lambdas: Assign-anywhere def statements Devin Jeanpierre <jeanpierreda@gmail.com> - 2015-01-24 12:35 -0800
  Re: Alternative to multi-line lambdas: Assign-anywhere def statements Yawar Amin <yawar.amin@gmail.com> - 2015-01-24 15:00 -0800

csiph-web