On Jul 14, 7:03 am, phonky wrote:
>
> Now, I do not know yet how the account number scheme looks like.
Exactly. The data store knows a lot more than the client (your
program) will ever know.
The correct answer is to do nothing. Use your data store to generate
the IDs for you. The implementations
Thanks for all replies.
I need to practice much more pythonese
In fact I don't think to understand all
of your suggestions, so I'll need to
go through them and decide what approach I am going
to take.
Thanks a lot!
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 14, 3:03 pm, phonky wrote:
> Hi
>
> I have searched all over and haven't found the solution
> for my problem yet. I am new to python, and all the time realize I
> do program python in java, which is not great.
>
> Besides being a real-life problem, I want to
> solve it as elegant as I can,
In article <23406$4a5c9c7d$d9a2f023$27...@news.hispeed.ch>,
phonky wrote:
>
>import itertools
>
> class Account(object):
>def __init__(self, holder, gen=itertools.count()):
> self.__accountnumber = gen.next()
>
>If you consider my python illiteracy,
>
>"itertools.count(): Ma
phonky 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 exa
phonky writes:
> "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?
You'd write a di
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.
Re
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
phonky writes:
> But where my stubborn java mind doesn't release me: what does the
> variable contain? Do I create the actual IncrementalGenerator object
> there? Or the super class? Or just a string, which a factory method
> takes to create the actual object?
Ugh, just forget everything you eve
Stefan, thanks first of all
Use a global variable in the module.
I have an account_number_generator variable in the module,
I got that hint from searching the web.
But where my stubborn java mind doesn't release me:
what does the variable contain? Do I create the actual
IncrementalGenerator o
Stefan Behnel 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 nu
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 productio
Hi
I have searched all over and haven't found the solution
for my problem yet. I am new to python, and all the time realize I
do program python in java, which is not great.
Besides being a real-life problem, I want to
solve it as elegant as I can, using it to
also learn about python (I know I co
13 matches
Mail list logo