[Python-ideas] Quick idea: defining variables from functions that take the variable name

Barry Warsaw barry at python.org
Mon Jun 6 18:23:13 EDT 2016


On May 31, 2016, at 01:08 PM, Steven D'Aprano wrote:

>This comes up a lot and it would be nice to clean it up.
>
>T = type('T', bases, ns)
>Record = namedtuple('Record', fields)
>
>It came up in the discussion on dict unpacking:
>
>a, b, c = **dict  # unpacks keys 'a', 'b', 'c'
>
>which was rejected as too magical. But maybe it will seem less magical if we
>have a special assignment operator that takes the left hand symbol(s) and
>copies them to the right?

It also comes up in @public for constants, which I currently support as:

public(a=SomeA())

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160606/366b2be8/attachment.sig>


More information about the Python-ideas mailing list