Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'subject:module': 0.04; 'happily': 0.07; 'read-only': 0.07; 'terry': 0.07; 'python': 0.08; 'attributes,': 0.09; 'const': 0.09; 'exception.': 0.09; 'properties,': 0.09; 'received:209.85.214.174': 0.13; 'attributes.': 0.16; 'reedy': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'level,': 0.18; 'cc:no real name:2**0': 0.21; 'header:In-Reply- To:1': 0.22; 'cc:2**0': 0.26; 'module': 0.26; 'raise': 0.28; 'message-id:@mail.gmail.com': 0.29; 'class': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'bare': 0.30; 'propose': 0.32; 'steven': 0.34; 'something': 0.35; 'received:209.85.214': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.38; 'think': 0.38; 'e.g.': 0.39; 'received:209': 0.39; 'cannot': 0.39; 'subject:Read': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Bu5M9zv5Rl8QeMl1XHrvCiPvkoRO0MAcTf9HmopJnfM=; b=M/Ab30XuCZH/tQJSy65579NNiiT4YV/HU6hi6xd8uUmXv0qyfY78vdPAQ/7PztZvUy e2+3mVvZUkyI1e7WhQcGIeLrXPTP7K9BRhXr8hm8bHjl0szEKxJ904ghZj7/wKNK1yzf r/c8CjmriIS+NEd22zoeYl+ClaZvHNaeKC9e4= MIME-Version: 1.0 In-Reply-To: References: <878vkc426c.fsf@benfinney.id.au> <4f346d28$0$29986$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 10 Feb 2012 10:09:24 +0000 Subject: Re: Read-only attribute in module From: Arnaud Delobelle To: Terry Reedy Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328868568 news.xs4all.nl 6949 [2001:888:2000:d::a6]:36663 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20152 On 10 February 2012 03:27, Terry Reedy wrote: > On 2/9/2012 8:04 PM, Steven D'Aprano wrote: > >> Python happily violates "consenting adults" all over the place. We have >> properties, which can easily create read-only and write-once attributes. > > > So propose that propery() work at module level, for module attributes, as > well as for class attributes. I think Steven would like something else: bare names that cannot be rebound. E.g. something like: >>> const a = 42 >>> a = 7 Would raise an exception. Is that right? -- Arnaud