Re: VB/Pascal with statement [was Re: Proposal for new minor syntax]

2015-03-28 Thread Rustom Mody
On Saturday, March 28, 2015 at 9:51:50 PM UTC+5:30, Rustom Mody wrote: > So if the VB model is followed, it is purely a syntactic (ie not type-related) > question whether an identifier is an adorned variable or an attribute of > something else. The preceding dot is the disambiguator. Uh... UN-ado

Re: VB/Pascal with statement [was Re: Proposal for new minor syntax]

2015-03-28 Thread Rustom Mody
On Saturday, March 28, 2015 at 11:56:39 AM UTC+5:30, Steven D'Aprano wrote: > On Sat, 28 Mar 2015 03:18 pm, Rustom Mody wrote: > > > One thing that is a bit laborious in python are object initializers: > > > > self.attr1 = field1 > > self.attr2 = field2 > > > > In VB one can do: > > > > with se

Re: VB/Pascal with statement [was Re: Proposal for new minor syntax]

2015-03-28 Thread Mark Lawrence
On 28/03/2015 12:58, Steven D'Aprano wrote: On Sat, 28 Mar 2015 11:26 pm, Mark Lawrence wrote: On 28/03/2015 06:26, Steven D'Aprano wrote: Pascal is another language with a construct like that, and there's a FAQ for it: https://docs.python.org/2/faq/design.html#why-doesn-t-python-have-a-w

Re: VB/Pascal with statement [was Re: Proposal for new minor syntax]

2015-03-28 Thread Steven D'Aprano
On Sat, 28 Mar 2015 11:26 pm, Mark Lawrence wrote: > On 28/03/2015 06:26, Steven D'Aprano wrote: >>Pascal is another language with a construct like that, and there's a FAQ >>for it: >> >> https://docs.python.org/2/faq/design.html#why-doesn-t-python-have-a-with-statement-for-attribute-assignments

Re: VB/Pascal with statement [was Re: Proposal for new minor syntax]

2015-03-28 Thread Mark Lawrence
On 28/03/2015 06:26, Steven D'Aprano wrote: On Sat, 28 Mar 2015 03:18 pm, Rustom Mody wrote: One thing that is a bit laborious in python are object initializers: self.attr1 = field1 self.attr2 = field2 In VB one can do: with self .attr1 = field1 .attr2 = field2 (or something like that -- do

Re: VB/Pascal with statement [was Re: Proposal for new minor syntax]

2015-03-27 Thread Chris Angelico
On Sat, Mar 28, 2015 at 5:26 PM, Steven D'Aprano wrote: > On Sat, 28 Mar 2015 03:18 pm, Rustom Mody wrote: > >> One thing that is a bit laborious in python are object initializers: >> >> self.attr1 = field1 >> self.attr2 = field2 >> >> In VB one can do: >> >> with self >> .attr1 = field1 >> .attr2