Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #110099
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Joonas Liik <liik.joonas@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Method Chaining |
| Date | Sat, 18 Jun 2016 17:05:25 +0300 |
| Lines | 54 |
| Message-ID | <mailman.116.1466258729.2288.python-list@python.org> (permalink) |
| References | <74831a84-7b05-4242-b4c0-4a90d147717b@googlegroups.com> <CAGgTfkPETwxb8kx1PcR+F5qVEm-pkxHFDE4=aw+WNE2itsM3+w@mail.gmail.com> <mailman.99.1466137450.2288.python-list@python.org> <33f73a24-4dcf-429b-9264-a3f3098f1cc3@googlegroups.com> <ed84c81e-a905-48d9-96ca-58aa5f419e68@googlegroups.com> <5763c2a7$0$1602$c3e8da3$5496439d@news.astraweb.com> <2dffea93-3dbd-4d04-93ed-6e02e3dd8660@googlegroups.com> <m1inx6wvni.fsf@iKarel.lan> <CAB1GNpRLRNDQ3f4a7MBeBXZqO+9ypR-uEEGW85arOwEimsQsdQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de zznsq1yIu/Xy8bAxQxewIwxNiThu76kPQre4VZVvc28w== |
| Return-Path | <liik.joonas@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'context': 0.05; 'removes': 0.05; 'friday,': 0.07; 'modifying': 0.07; 'url:msdn': 0.07; 'cc:addr:python-list': 0.09; 'ambiguity': 0.09; 'naturally': 0.09; 'subtle': 0.09; 'python': 0.10; 'def': 0.13; '2016': 0.16; 'cc:name:python': 0.16; 'chained': 0.16; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'url:faq': 0.16; 'wrote:': 0.16; 'pfxlen:0': 0.18; 'version.': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'header:In-Reply-To:1': 0.24; 'equivalent': 0.27; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'towards': 0.28; 'faq:': 0.29; 'now?': 0.29; 'oop': 0.29; "i'm": 0.30; 'url:mailman': 0.30; 'statement': 0.32; 'class': 0.33; 'url:python': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'surely': 0.33; 'url:listinfo': 0.34; 'this?': 0.34; 'received:google.com': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'cases': 0.36; 'url:library': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'difference': 0.38; 'version': 0.38; 'received:209': 0.38; 'mean': 0.38; 'does': 0.39; 'from:': 0.39; 'url:mail': 0.40; 'future': 0.60; 'care': 0.60; 'your': 0.60; 'leading': 0.61; 'here.': 0.62; 'more': 0.63; 'between': 0.65; 'url:en-us': 0.72; 'batchelder': 0.84; 'here!': 0.84; 'lean': 0.84; 'tastes': 0.84; 'utc+5:30,': 0.84; 'worth,': 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 :cc; bh=Eqna9k+ga1eiqc977tw3tXajCbtMyswGkJlFs1ukXs8=; b=kkPyrfDRAaNCE/ggsI5zV6vBeRHMFQNEXevrmw36mdc8myDEzHqvYO+RwiZz9YeSss uD+MMUWMt0+PsfG/ME+JdZguT5X5ELL+Jr2f2mbOEdWhm0AtlqzoW5uxlHOJ6SMwMQcD L2ttF+wA+mSxxWt2fQIt77Q5m5zM1Z7WlZLtwQDNQy7jzet0Y1eFiE3s13BKCTDnGg4O z7mxJdUv/wnXtNB32Y++atUBEbYMxeeteoN5HhkkGDhDE6MvEc8IPFpc06TWqNu2vfWz EeRDgZzFdijLJGbNEBQVZXpYcQsV5D4dSVr03eyYAkuZRMojiTvhlI4K3SJZV4p69JyS pNuQ== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Eqna9k+ga1eiqc977tw3tXajCbtMyswGkJlFs1ukXs8=; b=aK85K+ADruqBev5+9qeYa0XHtpMNWGMxClGe9+Z1fXuvRiCZaga3LR/lIzMipcKpgJ XFk8vTT4GI4v5E9LyYNZVrzf7v2JJHG/wAZfIK4yOHG5PrZTcsOpQ07FIKz7H1DGvq0p Sv0/pJ6ZWIVKSht67XGsi5wzs7sbWrXzGMSsmVWa8JCQ95LsULWpGF104FTs307O51wl G+TTf6HfOUgZ4T1eQCbiDiatHCwM5q0o9f37xWazZP4Cxi8Q2OiJCmy8UWxOp183gdm0 WmCq44xOwMhxXK32Xu8UBqWCkw47p6DmdGK4oSg7bTJUsAXC2TyMtq+IHV3q8nW2fxBM KhPQ== |
| X-Gm-Message-State | ALyK8tKcUL6pGRBGS7DbUXH/YIm41r0OtTQVPEQy0hui90cIyMzpREOXRpFgMZrZZYxxGxZXPgh/GIJrxn/VOg== |
| X-Received | by 10.107.173.196 with SMTP id m65mr11151736ioo.131.1466258726531; Sat, 18 Jun 2016 07:05:26 -0700 (PDT) |
| In-Reply-To | <m1inx6wvni.fsf@iKarel.lan> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <CAB1GNpRLRNDQ3f4a7MBeBXZqO+9ypR-uEEGW85arOwEimsQsdQ@mail.gmail.com> |
| X-Mailman-Original-References | <74831a84-7b05-4242-b4c0-4a90d147717b@googlegroups.com> <CAGgTfkPETwxb8kx1PcR+F5qVEm-pkxHFDE4=aw+WNE2itsM3+w@mail.gmail.com> <mailman.99.1466137450.2288.python-list@python.org> <33f73a24-4dcf-429b-9264-a3f3098f1cc3@googlegroups.com> <ed84c81e-a905-48d9-96ca-58aa5f419e68@googlegroups.com> <5763c2a7$0$1602$c3e8da3$5496439d@news.astraweb.com> <2dffea93-3dbd-4d04-93ed-6e02e3dd8660@googlegroups.com> <m1inx6wvni.fsf@iKarel.lan> |
| Xref | csiph.com comp.lang.python:110099 |
Show key headers only | View raw
On 18 June 2016 at 15:04, Pete Forman <petef4+usenet@gmail.com> wrote:
> Rustom Mody <rustompmody@gmail.com> writes:
>
>> On Friday, June 17, 2016 at 2:58:19 PM UTC+5:30, Steven D'Aprano wrote:
>>> On Fri, 17 Jun 2016 06:13 pm, Ned Batchelder wrote:
>>>
>>> > To me, it's a toss-up. The chained version is nice in that it
>>> > removes the repetition of "g". But the unchained version is more
>>> > explicit, and avoids the awkward parenthesis.
>>> >
>>> > I think I would lean toward the unchained version. Clearly tastes
>>> > can differ.
>>>
>>> Indeed. For what it's worth, I'm ever-so-slightly leaning towards
>>> Lawrence's taste here.
>>
>> More than 'slightly' out here!
>> One thing about python OOP that irritates me is the 'self.' clutter.
>> With a Pascal/VB style with-statement its naturally taken care of
>>
>> Yeah I know there is this FAQ:
>> https://docs.python.org/2/faq/design.html#why-doesn-t-python-have-a-with-statement-for-attribute-assignments
>>
>> I consider it bogus if we allow with to mean something like:
>> https://msdn.microsoft.com/en-us/library/wc500chb.aspx
>
> One subtle difference between your two citations is that VB uses a
> leading dot. Might that lessening of ambiguity enable a future Python to
> allow this?
>
> class Foo:
> def .set(a): # equivalent to def set(self, a):
> .a = a # equivalent to self.a = a
>
> Unless it is in a with statement
>
> with obj:
> .a = 1 # equivalent to obj.a = 1
> .total = .total + 1 # obj.total = obj.total + 1
>
> --
> Pete Forman
> --
> https://mail.python.org/mailman/listinfo/python-list
the leading dot does not resolve the ambiguity that arises from:
with ob_a:
with ob_b:
.attr_c = 42 # which object are we modifying right now?
also refer to "javascript the bad parts" about all the edege cases
that python would surely face.
also with is allready used for context managers..
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Method Chaining Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-16 19:02 -0700
Re: Method Chaining Steven D'Aprano <steve@pearwood.info> - 2016-06-17 12:39 +1000
Re: Method Chaining Michael Selik <michael.selik@gmail.com> - 2016-06-17 04:23 +0000
Re: Method Chaining Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-16 21:37 -0700
Re: Method Chaining Ned Batchelder <ned@nedbatchelder.com> - 2016-06-17 01:13 -0700
Re: Method Chaining Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-17 01:38 -0700
Re: Method Chaining Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-06-17 11:45 +0300
Re: Method Chaining Steven D'Aprano <steve@pearwood.info> - 2016-06-17 19:28 +1000
Re: Method Chaining Michael Selik <michael.selik@gmail.com> - 2016-06-17 13:34 +0000
Re: Method Chaining Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-17 15:26 -0700
Re: Method Chaining Michael Selik <michael.selik@gmail.com> - 2016-06-17 22:45 +0000
Re: Method Chaining Michael Selik <michael.selik@gmail.com> - 2016-06-17 23:10 +0000
Re: Method Chaining Rustom Mody <rustompmody@gmail.com> - 2016-06-17 09:48 -0700
Re: Method Chaining Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-17 15:25 -0700
Re: Method Chaining Pete Forman <petef4+usenet@gmail.com> - 2016-06-18 13:04 +0100
Re: Method Chaining Joonas Liik <liik.joonas@gmail.com> - 2016-06-18 17:05 +0300
Re: Method Chaining Pete Forman <petef4+usenet@gmail.com> - 2016-06-18 16:42 +0100
Re: Method Chaining Rustom Mody <rustompmody@gmail.com> - 2016-06-18 08:35 -0700
Re: Method Chaining Pete Forman <petef4+usenet@gmail.com> - 2016-06-19 11:16 +0100
Re: Method Chaining Ethan Furman <ethan@stoneleaf.us> - 2016-06-18 13:47 -0700
Re: Method Chaining Joonas Liik <liik.joonas@gmail.com> - 2016-06-19 14:56 +0300
Re: Method Chaining Ethan Furman <ethan@stoneleaf.us> - 2016-06-19 08:01 -0700
Re: Method Chaining Michael Torrie <torriem@gmail.com> - 2016-06-19 09:14 -0600
Re: Method Chaining Ethan Furman <ethan@stoneleaf.us> - 2016-06-19 08:56 -0700
Re: Method Chaining Rustom Mody <rustompmody@gmail.com> - 2016-06-19 09:03 -0700
Re: Method Chaining Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-17 15:22 -0700
Re: Method Chaining Ned Batchelder <ned@nedbatchelder.com> - 2016-06-17 17:02 -0700
csiph-web