Re: [Python-3000] Python/C++ question

2006-12-16 Thread Martin v. Löwis
Giovanni Bajo schrieb: >>> To me, the killer feature would be that in C++ you can implement a smart >>> pointer which takes care of incref/decref automatically for 99% of the >>> code. >>> This would be a terrific tool for the extension/core writers. >> Of course, this would also break in presen

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Talin
Guido van Rossum wrote: > I've been thinking about this too, and I think it's reasonable to let > the metaclass provide the dict to be used as locals. This is easier > when the metaclass is given in the class header, e.g. by way of a base > class, or through the default metaclass. Although the defa

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Josiah Carlson
Talin <[EMAIL PROTECTED]> wrote: [snip] > The main controversies are: Controversy is perhaps overstating it. There was disagreement. But it wasn't 300 posts and no names were called (that I can remember). > 1) How generalized the syntax should be. > > Several people, upon seeing your suggesti

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Phillip J. Eby
At 11:30 AM 12/16/2006 -0800, Talin wrote: >The general idea is to have the metaclass create a mapping object which >is used as the 'locals' dictionary for the suite following the class >statement. There would be some special-named function of the metaclass, >such as '__metadict__', which would con

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Talin
Josiah Carlson wrote: > Talin <[EMAIL PROTECTED]> wrote: >> There's also Josiah Carlson's proposal which separates the 'metaclass' >> function into two parts, the 'dict creation part' and the 'class >> finishing part'. (I.e. type= and dict=.) I would rather see them >> unified, as it makes the

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Talin
Josiah Carlson wrote: >> 2) What should the interface on the metaclass look like. >> >> The general idea is to have the metaclass create a mapping object which >> is used as the 'locals' dictionary for the suite following the class >> statement. There would be some special-named function of the

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Talin
Phillip J. Eby wrote: > At 11:30 AM 12/16/2006 -0800, Talin wrote: >> The general idea is to have the metaclass create a mapping object which >> is used as the 'locals' dictionary for the suite following the class >> statement. There would be some special-named function of the metaclass, >> such as

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Steven Bethard
Phillip J. Eby wrote: > There's mine, where you simply create mcls(name, bases, {}) and then map > locals operations to get/set/delattr operations on the class. This > would presumably be done using a simple mapping proxy, but it would be a > built-in type rather than the user having to implement

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Josiah Carlson
Talin <[EMAIL PROTECTED]> wrote: > > Josiah Carlson wrote: > > Talin <[EMAIL PROTECTED]> wrote: > >> There's also Josiah Carlson's proposal which separates the 'metaclass' > >> function into two parts, the 'dict creation part' and the 'class > >> finishing part'. (I.e. type= and dict=.) I woul

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Phillip J. Eby
At 02:39 PM 12/16/2006 -0700, Steven Bethard wrote: > > The main issue for me is that I think that its important to distinguish > > between get/set operations that are done at class definition time, and > > get/set operations that are done later, after the class is created. > >Why? Can you explain

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Phillip J. Eby
At 12:38 PM 12/16/2006 -0800, Talin wrote: >Phillip J. Eby wrote: >>At 11:30 AM 12/16/2006 -0800, Talin wrote: >>>The general idea is to have the metaclass create a mapping object which >>>is used as the 'locals' dictionary for the suite following the class >>>statement. There would be some special

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Talin
Steven Bethard wrote: >> The main issue for me is that I think that its important to distinguish >> between get/set operations that are done at class definition time, and >> get/set operations that are done later, after the class is created. > > Why? Can you explain your use case? Everything I'd

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Greg Ewing
Talin wrote: > My personal feeling on this issue is that just because the "keyword=X" > syntax opens up other possibilities, doesn't mean we have to use them. Even if the syntax was never used for anything else, I still don't like it. Metaclasses are an elegant concept that deserves an equally el

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Greg Ewing
Josiah Carlson wrote: > That could be trivially extended to support a tuple syntax for handling > meta dictionary support... > > class Foo(A, B) is type, dict: > ... -1. You're mangling my lovely syntax -- it no longer makes any sense! -- Greg ___

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Talin
Josiah Carlson wrote: > Maybe I'm strange, but I don't like the precreation/double calling > semantic. It just seems...sloppy? It requires modification of all > current metaclasses to update to the new metaclass= syntax, just to > possibly support a single operation, which, according to the discu

Re: [Python-3000] Metaclasses in Py3K

2006-12-16 Thread Phillip J. Eby
At 12:53 PM 12/17/2006 +1300, Greg Ewing wrote: >The main use case for all this seems to be that >some metaclasses would like to know the order in >which attributes were defined. So here's an >alternative proposal: Leave the syntax the way it >is, and *always* use a specialised dict that >remembers