Rustom Mody <rustompm...@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