[Tutor] (no subject)

2015-06-10 Thread rakesh sharma
I have come across this syntax in python. Embedding for loop in []. How far can things be stretched using this []. l = [1, 2, 3, 4, 5] q = [i*2 for i in l] print qthanksrakesh ___ Tutor maillist - Tutor@python.or

Re: [Tutor] (no subject)

2015-06-10 Thread Joel Goldstick
On Wed, Jun 10, 2015 at 6:36 AM, rakesh sharma wrote: > > I have come across this syntax in python. Embedding for loop in []. How far > can things be stretched using this []. > l = [1, 2, 3, 4, 5] > q = [i*2 for i in l] > print qthanksrakesh This is called a list comprehension. They are a more

Re: [Tutor] (no subject)

2015-06-10 Thread Alan Gauld
On 10/06/15 11:36, rakesh sharma wrote: I have come across this syntax in python. Embedding for loop in []. How far can things be stretched using this []. l = [1, 2, 3, 4, 5] q = [i*2 for i in l] This is a list comprehension which is a specific form of the more generalised "generator expressi

Re: [Tutor] Generate Prime Numbers

2015-06-10 Thread Mirage Web Studio
On 2015-05-31 5:04 AM, Alan Gauld wrote: On 30/05/15 19:14, George wrote: Excuse me please for replying late. I got lists to use the method and it is more efficient and faster. (Takes about 10 secs to process first 50 mil numbers) But now another problem i seem to notice that only 1 core

Re: [Tutor] Generate Prime Numbers

2015-06-10 Thread Laura Creighton
In a message of Wed, 10 Jun 2015 23:11:36 +0530, Mirage Web Studio writes: > > > >On 2015-05-31 5:04 AM, Alan Gauld wrote: >> On 30/05/15 19:14, George wrote: > >Excuse me please for replying late. > >I got lists to use the method and it is more efficient and faster. >(Takes about 10 secs to proce

Re: [Tutor] Generate Prime Numbers

2015-06-10 Thread Alan Gauld
On 10/06/15 18:41, Mirage Web Studio wrote: But now another problem i seem to notice that only 1 core of my amd Athlon X2 4core processor is being used. I suppose if all the four cores are simultaneously used then the programme might run even faster. Is there a way. One of the problems with t