Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20343

Re: Read-only attribute in module

Date 2012-02-13 03:57 -0800
From mloskot <mateusz@loskot.net>
References <CABUeae_vv=THd0VLsAteEKu7z8U2KA4p+vK1a=nAeMSKzM-L7g@mail.gmail.com> <jh161s$kqp$1@dough.gmane.org> <1328872312611-4382967.post@n6.nabble.com> <jh45p4$trk$1@dough.gmane.org>
Subject Re: Read-only attribute in module
Newsgroups comp.lang.python
Message-ID <mailman.5758.1329134265.27778.python-list@python.org> (permalink)

Show all headers | View raw


Terry Reedy wrote
> 
> 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,

Thanks for your really helpful notes.

Best regards,


-----
-- 
Mateusz Loskot
http://mateusz.loskot.net
--
View this message in context: http://python.6.n6.nabble.com/Read-only-attribute-in-module-tp4378950p4464760.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Read-only attribute in module mloskot <mateusz@loskot.net> - 2012-02-13 03:57 -0800

csiph-web