Python Forum
an object like a dictionary except ...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
an object like a dictionary except ...
#1
is it possible to create an object that works like a dict (e.g. can be indexed by any hashable key) but an internal method is called for fetching and storing values which gets the key and the value to store and returns the value that results from fetching?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Sure, you could implement the abstract methods of collections.abc.MutableMapping.
Skaperen likes this post
Reply


Forum Jump:

User Panel Messages

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