[Python-ideas] Syntax for making stuct / record / namedtuples

Georg Brandl g.brandl at gmx.net
Wed Oct 21 19:17:33 CEST 2009


Carl Johnson schrieb:
> I would also appreciate a faster way to do the boilerplate in an
> __init__ of saying self.arg1 = arg1, self.arg2 = arg2, etc. But what
> would be the global implications of changing locals() to an odict? Is
> that backwards compatible? If not, perhaps we could add a new builtin,
> say "olocals()" instead?

locals() does not only return function arguments.  You need to specify
the order of that ordered dictionary for such a function precisely.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.




More information about the Python-ideas mailing list