[Python-ideas] a simple namespace type

Eric Snow ericsnowcurrently at gmail.com
Mon May 28 18:34:38 CEST 2012


On Sun, May 27, 2012 at 2:09 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Slightly easier bar to reach: could the various incarnations be improved by
> using a new varobject type as a base class (e.g. I know I often use
> namedtuple as a base class rather than instantiating them directly, although
> I do the latter, too).

Good point.  I do the same.

> There's also a potentially less controversial alternative: just add an easy
> spelling for "type(name, (), {})" to the C API.

I really like this.  There's a lot of boilerplate to create just a
simple type like this in the C API.  I'll see what I can come up with.
 :)

As a namespace, it would be good to have a nice repr, but that's not a
show stopper.

-eric



More information about the Python-ideas mailing list