__autoinit__
Dan Sommers
me at privacy.net
Mon Jul 11 23:20:02 EDT 2005
On Mon, 11 Jul 2005 19:37:03 -0400,
Mike Meyer <mwm at mired.org> wrote:
> The question is - how far are you really willing to carry this? What
> do you think of allowing arbitrary lvalues, with the assumption that
> the previous arguments are all defined (ala let*)? So you could do:
> class grouping:
> def __init__(self, x, x['abc']):
> pass
Python already implements let*; it's called "tuple unpacking":
Python 2.3.3 (#1, Mar 9 2004, 14:21:31)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x, x['abc'] = {}, 3
>>> print x
{'abc': 3}
>>> x, x['abc'], x['abc'][4] = {}, range(10), -9999
>>> print x
{'abc': [0, 1, 2, 3, -9999, 5, 6, 7, 8, 9]}
Regards,
Dan
--
Dan Sommers
<http://www.tombstonezero.net/dan/>
More information about the Python-list
mailing list