Stefan Behnel <stefan...@behnel.de> writes: > phonky wrote: > > class Account(object): > > def __init__(self, holder): > > self.__accountnumber = self.__generate_account_number() > > > > Now, I do not know yet how the account number scheme looks like. > > For now, I just want to have an incremental number; later, > > when going to production, we'll need the proper one. > > Use a global variable in the module.
Yuch! Don't use a global. Try something like: import itertools class Account(object): def __init__(self, holder, gen=itertools.count()): self.__accountnumber = gen.next() -- http://mail.python.org/mailman/listinfo/python-list