Re: Pythonic way to iterate through multidimensional space?

2014-08-06 Thread Wojciech Giel
You might check numpy it is really powerful tool for working with multi dimensional arrays: ex. >>> a = arange(81).reshape(3,3,3,3) >>> a array( 0, 1, 2], [ 3, 4, 5], [ 6, 7, 8]], [[ 9, 10, 11], [12, 13, 14], [15, 16, 17]], [[18, 1

Re: What's the proper style for a library string function?

2014-07-19 Thread Wojciech Giel
On 19/07/14 18:38, C.D. Reimer wrote: Greetings, I typically write a Python 2.7 string function in my library like this: def getCompletedTime(start, end): return "Time completed:", str(end - start) And called it like this: print getCompletedTime(start, end) Since every Python scrip

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 12:40, Jerry lu wrote: oh yeah i forgot about the decorators. Um say that you wanted to decorate a function with the outer() func you would just put @outer on top of it? And this is the same as passing another func into the outer func? yes. syntax was added because with very long f

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 11:52, Jerry lu wrote: Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 1. I dont understand when i will need to use a function that returns another function. eg def outer():

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 11:52, Jerry lu wrote: Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 1. I dont understand when i will need to use a function that returns another function. eg def outer():