Python Forum
some dict's special methods
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
some dict's special methods
#1
hello,
i suppose that behind the:

>>> ca = {1:'koko', 2:'boko'}
>>> 1 in ca
True
>>> 5 in ca
False 
stays the dict's dunder '__contains__'
but i am not so sure which duner exactly stays behind:
>>> ca = {1:'koko', 2:'boko'}
>>> ca [3] = 'loko'
>>> ca 
{1: 'koko', 2: 'boko', 3: 'loko'}
>>> 
i think it could be '__setitem__', but i am not sure. is this '__setitem__' or some other special method? thanks in advance!
if the fans of jerry springer are more than the fans of carl sagan they will rule over us! what we gonna do?
Reply


Messages In This Thread
some dict's special methods - by nzcan - Dec-18-2018, 03:20 PM
RE: some dict's special methods - by buran - Dec-18-2018, 03:24 PM
RE: some dict's special methods - by nzcan - Dec-18-2018, 04:16 PM
RE: some dict's special methods - by buran - Dec-18-2018, 04:33 PM
RE: some dict's special methods - by nzcan - Dec-18-2018, 05:02 PM
RE: some dict's special methods - by buran - Dec-18-2018, 07:29 PM

Forum Jump:

User Panel Messages

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