```
class Cls:
    counter = 0
    def __init__(self, name):
        self.name = name
        self.counter += 1
    def count(self):
        return self.counter

```

I'm learning python, what I want to have is a static counter that counts the number of times the class has been instantiated, but every time I create an instance `counter` gets recreated and `count()` function always returns 1.
I want something that in java would look like this

```
public class Cls {
    private static int counter = 0;
    private String name;
    public Cls(String name) {
        this.name = name;
        counter ++;
    }
    public static int count(){
        return counter;
    }
}

```