Python Forum
where is this documented?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
where is this documented?
#8
foo = {}.update(os.environ)
foo is None because the method update returns None.
You can do this technique with data types, which returns a new copy of them selfs if mutated (str does this).

It's the same pitfall like this:
sorted_list = [1,4,5,6,7,3,2].sort()
list.sort() makes an inline sort (mutating the object itself) and returns None.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
where is this documented? - by Skaperen - Feb-17-2018, 01:46 AM
RE: where is this documented? - by Larz60+ - Feb-17-2018, 01:59 AM
RE: where is this documented? - by Gribouillis - Feb-17-2018, 01:32 PM
RE: where is this documented? - by Skaperen - Feb-18-2018, 04:23 AM
RE: where is this documented? - by Gribouillis - Feb-18-2018, 06:37 AM
RE: where is this documented? - by Skaperen - Feb-19-2018, 07:19 AM
RE: where is this documented? - by snippsat - Feb-19-2018, 11:36 AM
RE: where is this documented? - by DeaD_EyE - Feb-19-2018, 01:56 PM
RE: where is this documented? - by Skaperen - Feb-20-2018, 03:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  issubclass() not as documented Skaperen 19 7,999 Mar-15-2021, 04:58 PM
Last Post: nilamo
  format spec %b is documented but does not work Skaperen 13 10,743 Jul-31-2017, 09:21 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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