Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'win32': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject: [': 0.09; 'python': 0.11; 'language.': 0.14; 'nameerror:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'url:faq': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'feb': 0.22; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'faq': 0.24; '(or': 0.24; 'subject:/': 0.26; 'defined': 0.27; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'skip:( 20': 0.30; '"",': 0.31; "d'aprano": 0.31; 'pascal': 0.31; 'steven': 0.31; 'file': 0.32; 'another': 0.32; 'url:python': 0.33; '(most': 0.33; 'subject:with': 0.35; 'something': 0.35; 'url:org': 0.36; 'subject:new': 0.38; 'subject:]': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'name': 0.63; 'our': 0.64; 'more': 0.64; 'charset:windows-1252': 0.65; 'dont': 0.67; 'mar': 0.68; '2015': 0.84; 'received:89': 0.85; 'do:': 0.91; 'subject:Proposal': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: VB/Pascal with statement [was Re: Proposal for new minor syntax] Date: Sat, 28 Mar 2015 12:26:43 +0000 References: <9c9703b6-cfa6-4e91-900e-3a401562cb9e@googlegroups.com> <5516498e$0$13014$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-89-240-175-14.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: <5516498e$0$13014$c3e8da3$5496439d@news.astraweb.com> 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427545673 news.xs4all.nl 2939 [2001:888:2000:d::a6]:44604 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88223 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 -- 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 > c:\cpython\PCbuild>python Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> help(FAQ) Traceback (most recent call last): File "", line 1, in NameError: name 'FAQ' is not defined >>> help('FAQ') no Python documentation found for 'FAQ' Less than useless, now what? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence