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


Groups > comp.lang.python > #20069

Read-only attribute in module

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 <mateusz@loskot.net>
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 <mateusz@loskot.net>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5583.1328787848.27778.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

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


Thread

Read-only attribute in module Mateusz Loskot <mateusz@loskot.net> - 2012-02-09 11:43 +0000
  Re: Read-only attribute in module Ben Finney <ben+python@benfinney.id.au> - 2012-02-09 23:32 +1100
    Re: Read-only attribute in module mloskot <mateusz@loskot.net> - 2012-02-09 08:44 -0800
    Re: Read-only attribute in module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-10 01:04 +0000
      Re: Read-only attribute in module Terry Reedy <tjreedy@udel.edu> - 2012-02-09 22:27 -0500
        Re: Read-only attribute in module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-10 22:23 +0000
      Re: Read-only attribute in module Arnaud Delobelle <arnodel@gmail.com> - 2012-02-10 10:09 +0000

csiph-web