Hacker News new | ask | show | jobs
by catlover76 317 days ago
? I read the first example and it's dumb.

> What happened? Well, it turns out you’re always getting the same instance, no matter what parameters you pass. Your second call to Singleton(name="Bob", age=25) didn’t create anything new — it just silently reused the original object, with its original attributes. No warning. No error. Just quietly wrong.

It's not wrong, it's right. No shit it "didn't create anything new"--it's not supposed to. It's a Singleton.