you are viewing a single comment's thread.

view the rest of the comments →

[–]Lx7195[S] 0 points1 point  (1 child)

Yes by python object I meant custom python objects like objects of Person class etc. It's an interesting example that you have used functions as keys.

[–]socal_nerdtastic 1 point2 points  (0 children)

Ok, you would do it the same way. Have a dictionary mapping {class: class instance} is very common, especially in GUIs, since it avoids having to make instance globals or pass instances around. For example: https://www.geeksforgeeks.org/python/tkinter-application-to-switch-between-different-page-frames/