Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:module': 0.04; 'defines': 0.07; 'mess': 0.07; 'received:verizon.net': 0.07; 'run,': 0.07; 'terry': 0.07; 'function:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'am,': 0.12; 'library': 0.13; 'reedy': 0.16; 'wrote:': 0.18; 'jan': 0.19; 'header:In-Reply-To:1': 0.22; 'once.': 0.23; 'library.': 0.24; 'otherwise,': 0.25; 'module': 0.26; 'constant': 0.29; 'module.': 0.29; 'keeps': 0.30; 'header :User-Agent:1': 0.33; 'decide': 0.33; 'header:X-Complaints-To:1': 0.34; 'flag': 0.34; 'to:addr:python-list': 0.35; 'project': 0.35; 'received:org': 0.36; 'could': 0.38; 'some': 0.38; 'think': 0.38; 'option': 0.39; 'that.': 0.39; 'everyone': 0.39; 'user': 0.40; 'change': 0.40; 'might': 0.40; 'to:addr:python.org': 0.40; 'else.': 0.67; 'concept': 0.74; 'freeze': 0.84; 'subject:Read': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Read-only attribute in module Date: Fri, 10 Feb 2012 17:29:36 -0500 References: <1328872312611-4382967.post@n6.nabble.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <1328872312611-4382967.post@n6.nabble.com> 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328913015 news.xs4all.nl 6953 [2001:888:2000:d::a6]:60627 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20198 On 2/10/2012 6:11 AM, mloskot wrote: > The intent of xyz.flag is that it is a value set by the module internally. > xyz is a module wrapping a C library. > The C library defines concept of a global flag set by the C functions at > some events, > so user can check value of this flag. > I can provide access to it with function: xyz.get_flag() If the value of the flag can change during a run, I would do that. Otherwise, you have to make sure the local copy keeps in sync. Users might also think that it is a true constant that they could read once. I understand that you might be concerned that one person in a multi-programmer project might decide to rebind xyz.flag and mess up everyone else. I think the real solution might be an option to freeze an entire module. -- Terry Jan Reedy