Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111106

Re: How well do you know Python?

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: How well do you know Python?
Date 2016-07-05 16:38 +1000
Message-ID <mailman.88.1467700722.2295.python-list@python.org> (permalink)
References <CAPTjJmoZobGYDh8jWDPPWQqoN-gid+-HUp9-dtKX_Vp=BgHc+w@mail.gmail.com> <mailman.83.1467691359.2295.python-list@python.org> <577b54b8$0$1589$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmq8uWZtGqMGRQiWZr7ceEyNLJF=uXnf0Jpu1ZbgvqztaQ@mail.gmail.com>

Show all headers | View raw


On Tue, Jul 5, 2016 at 4:33 PM, Steven D'Aprano
<steve+comp.lang.python@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How well do you know Python? Chris Angelico <rosuav@gmail.com> - 2016-07-05 14:02 +1000
  Re: How well do you know Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-07-05 16:05 +1000
  Re: How well do you know Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-07-05 16:33 +1000
    Re: How well do you know Python? Chris Angelico <rosuav@gmail.com> - 2016-07-05 16:38 +1000
      Re: How well do you know Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-07-05 18:22 +1000
        Re: How well do you know Python? Christian Gollwitzer <auriocus@gmx.de> - 2016-07-05 11:13 +0200
    Re: How well do you know Python? Chris Angelico <rosuav@gmail.com> - 2016-07-05 19:17 +1000
      Re: How well do you know Python? Quivis <quivis@domain.invalid> - 2016-07-05 21:55 +0000

csiph-web