Q:

Is it best practice to avoid 'self' instances?

If I were to implement a class, such as:
class LinkedList:

    def __init__(self):
        self.head = None

    def size(self):
        self.count = 0
        self.current = self.head

        while self.current != None:
            self.current = self.current.get_next()
            self.count += 1

        return self.count

The size method would work perfectly fine without using self. for the count and current variables, so I was wondering:

Why is it the case that count and current work both with and without self., whereas self.head wouldn't work without it?
Is it generally bad practice to use self. in cases where it isn't necessarily required?

A:

Using self object you are attaching those variable with the class object, where it can accessible throughout the class.
If self is omitted then the scope of those variable in only inside the size function.

