Python Forum
a dictionary with a key default
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a dictionary with a key default
#1
i can use the method .get() on a dictionary to use a single specific default. i would like to have a simple means like that which can be inserted into an expression which will return the value of the key itself if there is no matching key in the dictionary. i do not want something that requires expressing the key twice, so i can use costly key expressions and/or key expressions with side effects.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
a dictionary with a key default - by Skaperen - Jan-17-2020, 03:01 AM
RE: a dictionary with a key default - by buran - Jan-17-2020, 07:11 AM
RE: a dictionary with a key default - by perfringo - Jan-17-2020, 07:56 AM
RE: a dictionary with a key default - by Skaperen - Jan-18-2020, 12:26 AM
RE: a dictionary with a key default - by Skaperen - Jan-18-2020, 04:14 AM

Forum Jump:

User Panel Messages

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