On Tue, Oct 6, 2020, at 23:13, Guido van Rossum wrote:
A. New syntax is way too high a bar for a questionable feature. Classes full of static or class methods were a pattern at my last employer and it was unpleasant to work with. (Others at the company agreed but it was too late to change.)
B. At some point we realized that metaclasses have too much power over subclasses (action at a distance) and we switched to recommending class decorators. Another problem with metaclasses is that it's a pain to combine two different metaclasses.
I think a metaclass [well, "pseudo-metaclass", to use a term I made up for a metaclass that is not a subclass of type and/or does not return an instance of type] would be better in this case because the resulting object should not be a type. The reason I wanted different syntax was because I wanted to change how the functions inside are compiled [to allow nonlocal accesses to refer to the namespace's scope], though I think making them globals and a custom dict subclass [possibly ChainMap, haven't checked if it does everything I want] for globals makes this workable as a metaclass or decorator - either one can take all of the functions and replace them with a new function with different globals and the original function's code object.
namespace Foo: x=1 def bar(): pass def baz() return bar() + x
That could be done with a function and a function decorator. "Proof left as an exercise for the reader." :-)