[Python-Dev] Module properties for C modules (original) (raw)

Christian Heimes lists at cheimes.de
Thu May 1 21:32:19 CEST 2008


Guido van Rossum schrieb:

But wouldn't this mean that those properties would no longer be available in the module's dict?

Correct. Module properties would behave exactly like instance properties. They don't appear on the instance's dict attribute, too.

By the way I was astonished that the vars() function dones't show properties but dir() does list them.

class Example(object): ... @property ... def x(self): ... return 42 ... example = Example() example.dict {} vars(example) {} dir(example) ['class', 'delattr', 'dict', 'doc', 'getattribute', 'hash', 'init', 'module', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'str', 'weakref', 'x']

Christian



More information about the Python-Dev mailing list