Re: [Tutor] running modules as scripts

2013-12-05 Thread Steven D'Aprano
On Thu, Dec 05, 2013 at 01:20:05PM -0500, uga...@talktalk.net wrote: > I have some difficulty with the abovet. I succeeded after a fashion, > but only after some experiment, and I am not satisfied that all is > well. Here is the script code (as per the Python tutorial 6.1.1.): > It is saved in

[Tutor] running modules as scripts

2013-12-05 Thread ugajin
I have some difficulty with the abovet. I succeeded after a fashion, but only after some experiment, and I am not satisfied that all is well. Here is the script code (as per the Python tutorial 6.1.1.): def fib(n):# write Fibonacci series up to n a, b = 0, 1 while b < n: prin

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread R. Alan Monroe
> What does the OP actually want? I started writing another fake defrag program to entertain myself in a little downtime at work. The FAT-styled "drive" is just a Python list of integers where each element points to the the next "block" of the fictitious "file", with the last element of any given

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread R. Alan Monroe
> There is a name for this: it is called a RANK TABLE. Handy. That should help. Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread spir
On 12/05/2013 12:02 PM, Alan Gauld wrote: But the OP didn't ask for the final transform he asked for the list of transforms that got from A to B. That means all of the intermediate steps. At least that's how I read his statement "list-of-transforms that got me from before to after" I did not re

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread spir
On 12/05/2013 11:52 AM, Steven D'Aprano wrote: There is a name for this: it is called a RANK TABLE. In the example given: values = [3, 1, 2, 5, 4] the rank table gives the rank of each element, that is, the position they would get after sorting. In this case, the rank table is not terribly exci

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread Alan Gauld
On 05/12/13 10:52, Steven D'Aprano wrote: On Thu, Dec 05, 2013 at 09:55:27AM +, Alan Gauld wrote: before: 3 1 2 5 4 after: 1 2 3 4 5 Is there a well-known algorithm that can give me the list-of-transforms that got me from before to after? No. The reason being that it depends on the s

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread Steven D'Aprano
On Wed, Dec 04, 2013 at 10:56:32PM -0500, R. Alan Monroe wrote: > Given two lists, before and after a sort: > 0 1 2 3 4 > - > before: 3 1 2 5 4 > after: 1 2 3 4 5 > > Is there a well-known algorithm that can give me the > list-of-transforms that got me from before to a

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread Steven D'Aprano
On Thu, Dec 05, 2013 at 09:55:27AM +, Alan Gauld wrote: > On 05/12/13 03:56, R. Alan Monroe wrote: > >Given two lists, before and after a sort: > > 0 1 2 3 4 > > - > >before: 3 1 2 5 4 > >after: 1 2 3 4 5 > > > >Is there a well-known algorithm that can give me the >

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread Alan Gauld
On 05/12/13 03:56, R. Alan Monroe wrote: Given two lists, before and after a sort: 0 1 2 3 4 - before: 3 1 2 5 4 after: 1 2 3 4 5 Is there a well-known algorithm that can give me the list-of-transforms that got me from before to after? No. The reason being that i

[Tutor] (no subject)

2013-12-05 Thread Ismar Sehic
Ismar, the following don't look like Python lists to me. It's not clear which bits are supposed to be from the Python list, which bits are comments you have added. In your first example, it looks to me like one int (3628), followed by a list of longints, [36L, 317L], followed by perhaps a string "r