Re: enhanced map function

2011-03-17 Thread Patrick
Steven, Thanks for the info of itertools. It is a great start for me. Overall, I agree with you that it is really the user data needs to be sorted out. However, novice users may need help on certain patterns such as a=[1,[2,3],4], b=[5,[6,7,8],9,10]. We could just draw our line saying that

Re: enhanced map function

2011-03-17 Thread Steven D'Aprano
On Thu, 17 Mar 2011 08:31:28 -0700, Patrick wrote: Steven, Thanks for the info of itertools. It is a great start for me. Overall, I agree with you that it is really the user data needs to be sorted out. However, novice users may need help on certain patterns such as a=[1,[2,3],4],

enhanced map function

2011-03-11 Thread Patrick
nesting only. I am looking for examples that could hand input of a = [2,3], b=4 and a=[1,[2,3],4], b=[5,[6,7,8],9,10]. That means if the nesting structure is the same, enhanced map function will automatically extend the shorter list using the last element. Or if the input is a constant at the first

Re: enhanced map function

2011-03-11 Thread Steven D'Aprano
is the same, enhanced map function will automatically extend the shorter list using the last element. It isn't clear what you want here. Are you expecting this enhanced map to recursively drop down into each layer of sub-sequences? That is: enhanced_map([1, [2,3, [4,5], 6], 7], [8, [7,6, [5,4], 3