Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #110096
| From | Pete Forman <petef4+usenet@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Method Chaining |
| Date | 2016-06-18 13:04 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <m1inx6wvni.fsf@iKarel.lan> (permalink) |
| References | (2 earlier) <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> |
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
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