Re: [Python-Dev] Module properties for C modules

2008-05-01 Thread Guido van Rossum
On Thu, May 1, 2008 at 2:00 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Guido van Rossum schrieb: > > > I don't see how it could work if any Python code is executed in the > > module, since code execution uses a dict for globals. > > > > Supporting it only for built-in modules seems too bi

Re: [Python-Dev] Module properties for C modules

2008-05-01 Thread Christian Heimes
Guido van Rossum schrieb: > I don't see how it could work if any Python code is executed in the > module, since code execution uses a dict for globals. > > Supporting it only for built-in modules seems too big an exception. I came up with the idea in order to replace the setters and getters of bu

Re: [Python-Dev] Module properties for C modules

2008-05-01 Thread Guido van Rossum
On Thu, May 1, 2008 at 1:20 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > What's your opinion on the module properties idea? Do you still like it > although the property values won't show up in __dict__? I don't see how it could work if any Python code is executed in the module, since code e

Re: [Python-Dev] Module properties for C modules

2008-05-01 Thread Christian Heimes
Guido van Rossum schrieb: > On Thu, May 1, 2008 at 12:32 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: >> 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 exact

Re: [Python-Dev] Module properties for C modules

2008-05-01 Thread Guido van Rossum
On Thu, May 1, 2008 at 12:32 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > 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. T

Re: [Python-Dev] Module properties for C modules

2008-05-01 Thread Christian Heimes
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

Re: [Python-Dev] Module properties for C modules

2008-04-30 Thread Guido van Rossum
On Wed, Apr 30, 2008 at 2:17 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > As you all know modules don't support properties. However several places > and modules could use properties on module level. For example the > sys.py3k_warnings flag could be implemented with a property. Other flags >

Re: [Python-Dev] Module properties for C modules

2008-04-30 Thread Christian Heimes
Benjamin Peterson schrieb: > Good idea. Perhaps eventually they could be extended to Python, but > they are definitely useful in C now. How about passing a list of > getsets to PyImport_InitModule(5)? Yeah, I've a similar idea with PyImport_InitModule5() and a list of structs containing name, gett

Re: [Python-Dev] Module properties for C modules

2008-04-30 Thread Benjamin Peterson
On Wed, Apr 30, 2008 at 4:17 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Hello Python Dev! > > As you all know modules don't support properties. However several places > and modules could use properties on module level. For example the > sys.py3k_warnings flag could be implemented with a p

[Python-Dev] Module properties for C modules

2008-04-30 Thread Christian Heimes
Hello Python Dev! As you all know modules don't support properties. However several places and modules could use properties on module level. For example the sys.py3k_warnings flag could be implemented with a property. Other flags in the sys module could benefit from read only properties, too. How