How well do you know Python?

Chris Angelico rosuav at gmail.com
Tue Jul 5 02:38:38 EDT 2016


On Tue, Jul 5, 2016 at 4:33 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> What happens in this code snippet?
>
>     L = [1]
>     t = (L,)
>     t[0] += 1
>
> Explain what value t has, and why.

Not sure you have that question right, because it simply gives a
TypeError. You can't add an integer to a list.

ChrisA



More information about the Python-list mailing list