[Python-ideas] PEP 4XX: Adding sys.implementation
Steven D'Aprano
steve at pearwood.info
Wed May 2 03:24:19 CEST 2012
Nick Coghlan wrote:
> Would it be
> better if we had a separate "namespace" type in CPython that simply
> *disallowed* iteration and indexing? Perhaps, but we've survived long
> enough without it that I have my doubts about the practical need.
I have often wanted a namespace type, with class-like syntax and module-like
semantics. In pseudocode:
namespace Spam:
x = 1
def ham(a):
return x+a
def cheese(a):
return ham(a)*10
Spam.cheese(5)
=> returns 60
But I suspect that's not what you're talking about here in context.
--
Steven
More information about the Python-ideas
mailing list