>
> $ def unpack_set():
> >     return {*()}
> >
> $ dis.dis(unpack_set)
>   2           0 BUILD_SET                0
>               2 LOAD_CONST               1 (())
>               4 SET_UPDATE               1
>               6 RETURN_VALUE
>

Seems like the peephole optimizer could be trained to easily recognize that
the LOAD_CONST/SET_UPDATE pair will be a no-op.

Skip
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/OVFLVPSKHJWZ5FYDELRCXP66JCQUL33G/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to