Read-only attribute in module

Mateusz Loskot mateusz at loskot.net
Thu Feb 9 12:43:44 CET 2012


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



More information about the Python-list mailing list