[Python-Dev] sys.implementation (original) (raw)

Larry Hastings larry at hastings.org
Thu May 10 02:47:49 CEST 2012


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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120509/53bfed25/attachment.html>



More information about the Python-Dev mailing list