Re: function that counts...

2010-05-19 Thread René 'Necoro7; Neumann
Am 19.05.2010 22:58, schrieb superpollo: > > In [277]: prttn(25, 1) > Out[277]: 348 > > In [278]: prttn2(25, 1) > Out[278]: 348 > > In [279]: prttn3(25, 1) > Out[279]: 348 > > ok, bye! Just because I was curios: nec...@zakarumiy ~ % python -m timeit "import test; test.prttn(25,100

Re: function that counts...

2010-05-19 Thread René 'Necoro7; Neumann
Am 19.05.2010 21:58, schrieb superpollo: > ... how many positive integers less than n have digits that sum up to m: > > In [197]: def prttn(m, n): > tot = 0 > for i in range(n): > s = str(i) > sum = 0 > for j in range(len(s)): > sum += int(s[j]) >

Re: recall function definition from shell

2010-05-18 Thread René 'Necoro7; Neumann
Am 18.05.2010 20:55, schrieb superpollo: > > yes python does not, but maybe the *shell* does, or so i thought. i just > wanted to dump the code for the function in a file, after i tested in > the shell... You might want to have a look at the IPython shell [1]. I personally do not use it myself, b

Re: object vs class oriented -- xotcl

2008-01-31 Thread neumann
On 29 Jan., 19:22, William Pursell <[EMAIL PROTECTED]> wrote: > I > believe "per object mixin" is the correct > term for such an animal. The first several google > hits on that phrase all reference xotcl, so I'm > not sure if that is an xotcl inspired vocabulary > that isn't really standard. wel

Re: removing characters before writing to file

2006-02-09 Thread Stefan Neumann
[EMAIL PROTECTED] wrote: > hi > i have some output that returns a lines of tuples eg > > ('sometext1', 1421248118, 1, 'P ') > ('sometext2', 1421248338, 2, 'S ') > and so on > > If the braces are always at the begining and at the end of the string, you could also use: >>> "('sometext1

Daemon terminates unexpected

2006-02-06 Thread Stefan Neumann
I have written a daemon which should run endlessly. The structure looks like this: - start-stop-daemon forks my python program then: if __name__=="__main__": try: main() except Exception,e def main(): # I need a starter to use the program also from the unittests

Re: While loop - print several times but on 1 line.

2006-01-26 Thread Stefan Neumann
Danny wrote: > How could I make this print: texttexttexttexttext? > Ive researched and looked through google and so far I can't find > anything that will help (or revelent for that matter). I am not quite sure, if I simplify the problem but i thought about something like that: >>> prin