To start with, I'm renaming UserClass to User (we know it's a class) and UserID to id (it's in the User class so no need to repeat the "User" bit, and Python style recommends lowercase), and __user_id_counter to __id_counter (ditto). Read PEP 8 for Python style guidelines.
So then, our starting point is this:
class User(object):
__id_counter = 0
def __init__(self, id=None) :
self.id = self.__id_counter if id is None else id
__id_counter += 1
myuser = User()
myuser2 = User()
myuser3 = User()
Now, the double leading underscore (without a double trailing underscore as in things like __init__ and __metaclass__) is special, and is used for an implementation of class-private variables - read about private variables in the Python manual for more info. It triggers what's called "name mangling". What it ends up as is with __id_counter being renamed to _User__id_counter throughout the class. This is both useful and dangerous. In this case, I think it's probably just not necessary.
This can lead to a problem with subclasses.
class SpecialUser(User):
def __init__(self):
self.__id_counter
Now, SpecialUser() will trigger an AttributeError: 'SpecialUser' object has no attribute '_SpecialUser__id_counter'.
So then the question is, do you want subclasses to have the same ID counter, or their own ID counters?
If you want them to have the same ID counter, use User.__id_counter. Don't use self.__class__.__id_counter or type(self).__id_counter with the += 1, as this will, for a SpecialUser instance, set SpecialUser._User__id_counter to User._User__id_counter + 1, and then SpecialUser will use its own _User__id_counter from this point onwards, which is far from what you want.
If you want them to have their own ID counters, start by using _id_counter rather than __id_counter, as the name mangling will take you in a direction you don't want to go.
There are a couple of approaches you can take:
Use a metaclass to give each class its own counter variable (a more advanced topic than I can be bothered writing about at the moment, ask for more details if you want to).
Put in a line _id_counter = 0 in each class definition. (If you don't, you'll run into trouble with ID starting point - make a lot of them, e.g. User(), User(), SpecialUser(), User(), SpecialUser(), SpecialUser(), User(), and they'll have IDs of (respectively) 0, 1, 2, 2, 3, 4, 3 rather than 0, 1, 0, 2, 1, 2.
An additional inefficiency which would arise from using the name mangling approach here would be that subclasses will have multiple counters in them - _User__id_counter, _SpecialUser__id_counter, etc.