one-time factory in python for an experienced java guy
phonky
phonky at europe.com
Tue Jul 14 10:55:56 EDT 2009
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?
More information about the Python-list
mailing list