What Paul was trying to elaborate on is that have your customers or whomever will use this implement their own generator protocol to generate whatever number format they need. Paul just gave you an example with itertools.count(), where it is an infinite generator that yields count+1 every time.
Read up on the iterator protocol, have your customers pass in a generator to establish their own formats. http://docs.python.org/library/stdtypes.html#iterator-types This is much more elegant than AbstractCustomerRandomFormatGenerator..etc which is what the reference to "erase everything from Java" is attempting to relate. -- mahmoud mack abdelkader python powered http://blog.mahmoudimus.com/ mahm...@linux.com On Tue, Jul 14, 2009 at 10:55 AM, phonky <pho...@europe.com> wrote: > Thanks Paul, > > Ugh, just forget everything you ever knew about java. Do some Zen >> exercises to erase your mind. Then read a Python tutorial as if >> you're starting from nothing. >> > > Yeah, surely right, but easier said than done... > I'm working on it. > > Taking your example. > > import itertools > > class Account(object): > def __init__(self, holder, gen=itertools.count()): > self.__accountnumber = gen.next() > > If you consider my python illiteracy, > > "itertools.count(): Make an iterator that returns consecutive integers > starting with n" > > to me that sounds like that solves the increment issue, but what about > future modules wanting to plug in a different > numbering format, e.g. 205434.1234 or whatever? > > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list