Comment

Comment by NeutralForest

I've never seen anybody do that... In Python you can use a module as a singleton (mentioned in the article). Or provide some data like:

  from functools import lru_cache

  class Whatever:
      pass

  @lru_cache(maxsize=1)
  def get_whatever():
      return Whatever()
And use `get_whatever` as your interface to get the resource.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton