Python Forum
I don't understand this result
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I don't understand this result
#3
extend changes the list in place (and thus return None)

>>> f = [].extend(['spam', 32, 44])
>>> type(f)
<type 'NoneType'>
>>> f=[]
>>> f.extend(['spam', 32, 4])
>>> type(f)
<type 'list'>
>>> print f
['spam', 32, 4]
Reply


Messages In This Thread
RE: I don't understand this result - by snippsat - Jan-14-2017, 05:58 PM
RE: I don't understand this result - by buran - Jan-14-2017, 06:01 PM
RE: I don't understand this result - by Kebap - Jan-15-2017, 04:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Two same codes, different result. Please help to understand. vickyprabhat 5 3,781 Mar-24-2018, 11:33 PM
Last Post: vickyprabhat
  I don't understand this result Ponomarenko Pavlo 5 4,021 Mar-27-2017, 02:04 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020