Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:module': 0.04; 'api.': 0.05; 'attribute': 0.07; 'python': 0.08; 'attributes,': 0.09; 'received:209.85.214.174': 0.13; 'extension': 0.17; 'module': 0.26; 'import': 0.27; "i'm": 0.28; 'message- id:@mail.gmail.com': 0.29; 'error': 0.30; 'implementing': 0.32; 'familiar': 0.32; 'implement': 0.32; 'there': 0.33; 'hi,': 0.34; 'to:addr:python-list': 0.35; 'received:209.85.214': 0.36; 'received:google.com': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'due': 0.66; 'subject:Read': 0.91 MIME-Version: 1.0 X-Originating-IP: [82.110.183.162] From: Mateusz Loskot Date: Thu, 9 Feb 2012 11:43:44 +0000 Subject: Read-only attribute in module To: python-list@python.org Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkaaAzeyHgPtAfMt3W0o/8QIQRg/+5+MZuN7n4GeaN50jx7RVQbjAVb6Y9LIw9qIWRyHU6y 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328787848 news.xs4all.nl 6924 [2001:888:2000:d::a6]:37133 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20069 Hi, I'm implementing Python 3 extension using the Python C API. I am familiar with defining new types, implementing get/set for attributes, etc. I'm wondering, is there any mean to implement attribute in module scope which is read-only? So, the following import xyz print(xyz.flag) # OK xyz.flag = 0 # error due to no write access Best regards, -- Mateusz Loskot, http://mateusz.loskot.net