Namespaces are one honking great idea
Random832
random832 at fastmail.com
Fri Jul 1 10:40:08 EDT 2016
On Fri, Jul 1, 2016, at 10:13, Steven D'Aprano wrote:
> The biggest limitation is that I have to abuse the class statement to do
> this. In an ideal world, there would be syntactic support and a keyword:
>
> namespace Example:
> x = 0
> y = []
> def test(n): ...
>
> although others might argue that *not* needing a dedicated keyword is, in
> fact, better.
What might be nice would be a single syntax that isn't specific to
classes or your "namespaces".
namespace(type) Name:
"equivalent to class Name:"
namespace(whatever) Name:
"equivalent to class Name(metaclass=whatever)"
More information about the Python-list
mailing list