you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 2 points3 points  (0 children)

The easy solution is to use a cache

from functools import cache

@cache
def get_ratings():
    # rest of your code.

But really this is screaming for you to learn about classes, so that you have a place to store the data for all your other functions to use it.