Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86257
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'arguments': 0.09; 'emulate': 0.09; 'def': 0.12; 'language,': 0.12; '"&"': 0.16; '23,': 0.16; 'posting:': 0.16; 'slight': 0.16; 'syntactic': 0.16; 'variable.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'bit': 0.19; 'dependent': 0.19; 'feb': 0.22; '>>>': 0.22; 'input': 0.22; 'creating': 0.23; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; 'class': 0.32; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'two': 0.37; 'list': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'to:addr:python.org': 0.39; 'name': 0.63; 'more': 0.64; '2015': 0.84; 'is!': 0.84; 'object:': 0.84 |
| 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 :content-type; bh=iTuLCkenetQphn93N+VO0YwzYFRozW46L8X28IsLdr0=; b=dgqdx1wsKSZ6S6EsSfluotIvFdkoCvGNEWiVpDikHJZuIZsO4AE2j8Bdn59gnTJm7d zHjsslx3e7K5Yvv9mZpONrVls3DcYKAbcv71Xbqbq71REBO56J8JO7yScDMAMXKcu1YH X4z7bXrrB0n6rF8m3xwZOfgr/UksPPwzOyuHkhCOGXnA4oRyOrsxQlZXiP9+TW3LCkg3 taau/ZmhOteZNYLveZ5zg4ZeoAq4pMEssvq1Wj9nl3ezoydWMc1EIpGK0X+ren86ToGW Lf8Ah2DcSv9ZqpwVE6rvApiuQp9iExbAoLV0IMu+AVq2O+tVX7XIGqXVjr6sRsn2jlU4 MVHQ== |
| X-Received | by 10.70.38.163 with SMTP id h3mr21781906pdk.95.1424719813825; Mon, 23 Feb 2015 11:30:13 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <87385wh2ho.fsf@elektro.pacujo.net> |
| References | <54eb2357$0$3011$426a74cc@news.free.fr> <cl16ncF4a8mU1@mid.individual.net> <8761ascwt4.fsf@elektro.pacujo.net> <mailman.19094.1424716896.18130.python-list@python.org> <87385wh2ho.fsf@elektro.pacujo.net> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Mon, 23 Feb 2015 12:29:33 -0700 |
| Subject | Re: list storing variables |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.19097.1424719816.18130.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1424719816 news.xs4all.nl 2871 [2001:888:2000:d::a6]:39277 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:86257 |
Show key headers only | View raw
On Mon, Feb 23, 2015 at 12:06 PM, Marko Rauhamaa <marko@pacujo.net> wrote: > But there is! I just demonstrated it in a previous posting: > >> In Python, you can accomplish "&" by creating an object: >> >> >>> a = 3 >> >>> b = 4 >> >>> class AmpersandA: >> ... def get(self): return a >> ... def set(self, value): global a; a = value >> ... >> >>> class AmpersandB: >> ... def get(self): return b >> ... def set(self, value): global b; b = value >> ... >> >>> l = [ AmpersandA(), AmpersandB() ] >> >>> for m in l: >> ... m.set(7) >> ... >> >>> print(a) >> 7 >> >>> print(b) >> 7 >> >>> >> >> It's exactly like "&" in C escept it's a slight bit more verbose and the >> exact implementation is dependent on the name of the variable. "Sure, you can have list comprehensions in C! Just write a function whose arguments are two other functions and an input array." Obviously one can use any Turing-complete language to emulate features of any other Turing-complete language, but I think the point is that there is no syntactic support for it.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
list storing variables "ast" <nomail@invalid.com> - 2015-02-23 13:55 +0100
Re: list storing variables Dave Angel <davea@davea.name> - 2015-02-23 08:24 -0500
Re: list storing variables Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 15:49 +0200
Re: list storing variables Peter Pearson <pkpearson@nowhere.invalid> - 2015-02-23 17:35 +0000
Re: list storing variables Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 20:22 +0200
Re: list storing variables Peter Otten <__peter__@web.de> - 2015-02-23 19:41 +0100
Re: list storing variables Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 21:06 +0200
Re: list storing variables Chris Angelico <rosuav@gmail.com> - 2015-02-24 06:17 +1100
Re: list storing variables Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 22:25 +0200
Re: list storing variables Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-23 12:29 -0700
Re: list storing variables Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 22:38 +0200
Re: list storing variables Ben Finney <ben+python@benfinney.id.au> - 2015-02-24 09:03 +1100
Re: list storing variables Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-24 13:24 +1100
Re: list storing variables Marko Rauhamaa <marko@pacujo.net> - 2015-02-24 10:18 +0200
csiph-web