Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'advocate': 0.07; 'attribute': 0.07; 'subject: [': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'notation,': 0.16; 'url:faq': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'proposed': 0.22; 'cc:addr:python.org': 0.22; 'faq': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'implicit': 0.31; 'pascal': 0.31; 'steven': 0.31; 'another': 0.32; 'url:python': 0.33; 'subject:with': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'url:org': 0.36; 'subject:new': 0.38; 'improving': 0.38; 'subject:]': 0.38; 'pm,': 0.38; 'that,': 0.38; 'does': 0.39; 'dont': 0.67; 'mar': 0.68; '2015': 0.84; 'do:': 0.91; 'eliminates': 0.91; 'proposal,': 0.91; 'subject:Proposal': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=1OoQyIjGGfRJRINu2AZYmIu1SvhUGnKYEzvOKqHqbbc=; b=NkyjC4DCMhCyeuLhmBXlV1qe2Ou6gs+KCeU5rcr6o4DRN9sTORGdJi0FPggF30TIsP kaYAkxROXCX5wMzOAeowE1PG/hda4Af7HaqqAWUyZIDLfvK5+fUHcfclf3GaF5walyq5 gg59jwYn2sutYyqhLoPVL9scyyqI1XS9lBn6QfZ2cCiUaJuZuiefaf13L6ZDH6CNMkMx Ba3gqei9Lo0cb33veXW5tXJrRtuEtXF0ZG/m8JY0ri+ihEGnQLygY/Q/eHKQj42IXUSw c7U1J8shFxa0OdiO6KzpsRv679B/a2BkUGBurfi83IztYESJ5uLTHwphbmiRkwTwUqwp jCSQ== MIME-Version: 1.0 X-Received: by 10.50.61.175 with SMTP id q15mr3575031igr.34.1427524801451; Fri, 27 Mar 2015 23:40:01 -0700 (PDT) In-Reply-To: <5516498e$0$13014$c3e8da3$5496439d@news.astraweb.com> References: <9c9703b6-cfa6-4e91-900e-3a401562cb9e@googlegroups.com> <5516498e$0$13014$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 28 Mar 2015 17:40:01 +1100 Subject: Re: VB/Pascal with statement [was Re: Proposal for new minor syntax] From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427524804 news.xs4all.nl 2877 [2001:888:2000:d::a6]:49056 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88203 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 = field2 >> >> (or something like that -- dont exactly remember the syntax) > > > 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 While I don't advocate the proposal, it does have an important difference from the one cited in the FAQ - albeit a Tim-grit difference: the Pascal version has implicit attribute notation, where the proposed has a leading dot. This eliminates the ambiguity, though without majorly improving readability. ChrisA