On 05/09/2012 09:53 AM, Barry Warsaw wrote:
On May 09, 2012, at 11:09 AM, Brett Cannon wrote:
Sure, but couldn't we define this "empty" class in C code so that you can
use the C API with it as well and just provide a C function to get a new
instance?
+1
ISTM to be a companion to collections.namedtuple. IWBNI this new type was
also exposed in the collections module.
I like Alex Martelli's approach, which I recall was exactly this:
class namespace:
def __init__(**kwargs):
self.__dict__ = kwargs
That means all the initializers you pass in to the constructor get
turned into members.
//arry/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com