Re: [Tutor] optimization: faster than for

2007-07-02 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > The letter I equals to "282" because it has 2 points on the y axis > of the > first point, and 8 points on the y axis on the second, and then 2 on > the > last one. > > So the string would be translated into: > > 282017220300004222400722240172206 a

Re: [Tutor] optimization: faster than for

2007-07-01 Thread elis aeris
>> In [4]:import array >> In [5]:def f7(list): >>.5.: return array.array('B', list).tostring() >>.5.: >> >> In [6]:f7([97, 98, 99]) >> Out[6]:'abc' ugh the code it self is not generic python, that was an example of how to do this my project is OCR http://www.eternite.co.uk/gundam_

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Eike Welk
On Sunday 01 July 2007 23:53, Alan Gauld wrote: > "elis aeris" <[EMAIL PROTECTED]> wrote > > >> In [4]:import array > >> In [5]:def f7(list): > >>.5.: return array.array('B', list).tostring() > >>.5.: > >> > >> In [6]:f7([97, 98, 99]) > >> Out[6]:'abc' > > I can't remember which tool does

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > so, i should look into ipython's doc for this code? No, Ipython is just another shell, like IDLE. Its not a different version of python, it just displays its prompts differently is all. Alan G. ___ Tutor mail

Re: [Tutor] optimization: faster than for

2007-07-01 Thread elis aeris
of course. but i tried only the code, not rewriting the pixelget part into that, because I have to understand it first. so, i should look into ipython's doc for this code? ok, import array def f7(list): return array.array('B', list).tostring() f7([97, 98, 99]) Out[6]:'abc' searching with

Re: [Tutor] optimization: faster than for

2007-07-01 Thread John Fouhy
On 02/07/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "elis aeris" <[EMAIL PROTECTED]> wrote > > >> In [4]:import array > >> In [5]:def f7(list): > >>.5.: return array.array('B', list).tostring() > >>.5.: > >> > >> In [6]:f7([97, 98, 99]) > >> Out[6]:'abc' > I can't remember which tool do

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Luke Paireepinart
elis aeris wrote: > my reply > oh crancky! C# ! > > http://en.wikipedia.org/wiki/Iron_Python > > i better try to find the best way to do it with the official python > genre before venturing into that world of pain without PIL ! Please don't reply directly to me. Iron Python is an implementatio

Re: [Tutor] optimization: faster than for

2007-07-01 Thread elis aeris
my reply oh crancky! C# ! http://en.wikipedia.org/wiki/Iron_Python i better try to find the best way to do it with the official python genre before venturing into that world of pain without PIL ! Quote:- Hide quoted text - In [4]:import array In [5]:def f7(list): .5.: return arra

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Luke Paireepinart
elis aeris wrote: > oh crancky! C# ! > > > i better try to find the best way to do it with the official python > genre before venturing into that world of pain without PIL ! What are you talking about. ___ Tutor maillist - Tutor@python.org http://ma

Re: [Tutor] optimization: faster than for

2007-07-01 Thread elis aeris
oh crancky! C# ! i better try to find the best way to do it with the official python genre before venturing into that world of pain without PIL ! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote >> In [4]:import array >> In [5]:def f7(list): >>.5.: return array.array('B', list).tostring() >>.5.: >> >> In [6]:f7([97, 98, 99]) >> Out[6]:'abc' I can't remember which tool does this - IronPython maybe? but the Ins are Inputs, the numbers aret

Re: [Tutor] optimization: faster than for

2007-07-01 Thread elis aeris
oh i get it, it's line number. import array def f7(list): return array.array('B', list).tostring() f7([97, 98, 99]) ## NOW, this looks python ! ___ Tutor maillist - Tutor@python.org http://mail.pyt

Re: [Tutor] optimization: faster than for

2007-07-01 Thread elis aeris
so this is the actual code? [4]:import array [5]:def f7(list): .5.: return array.array('B', list).tostring() .5.: [6]:f7([97, 98, 99]) Output on the screen: [6]:'abc'- Hide quoted text - ___ Tutor maillist - Tutor@python.org http://mail.pytho

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Luke Paireepinart
elis aeris wrote: > ugh, can someone who is online at this time give me some pointers on > how to read this? > > i don't know how to look it up, > > in is listed, > out is not, so i am not sure if this is python at all. IN is what you INput into the python interpeter. OUT is what the interpreter O

Re: [Tutor] optimization: faster than for

2007-07-01 Thread elis aeris
ugh, can someone who is online at this time give me some pointers on how to read this? i don't know how to look it up, in is listed, out is not, so i am not sure if this is python at all. On 7/1/07, Eike Welk <[EMAIL PROTECTED]> wrote: On Sunday 01 July 2007 06:17, elis aeris wrote: > The for

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Eike Welk
On Sunday 01 July 2007 06:17, elis aeris wrote: > The for version, as claimed by > > http://www.python.org/doc/essays/list2str.html The fastest version of the algorithm is this one: In [4]:import array In [5]:def f7(list): .5.: return array.array('B', list).tostring() .5.: In [6]:f7([97,

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Kent Johnson
elis aeris wrote: > x = 0 > y = 0 > for x in xrange(1,1024,1): > for y in xrange(1,768,1): > rgb = image.getpixel((10, 12)) > > > > Luke said there is a faster way to do image.getpixel((10, 12)) > > so i am still waiting on that, > > the above has been improved many times and it'

Re: [Tutor] optimization: faster than for

2007-07-01 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote ` > oh yeah, he said getdata() but i don't know where it comes from He told you it was a method of the image... Another version of what you are doing uses a list comprehension which might be slightly faster: pixels = [image.getpixel((x,y)) for x in range

Re: [Tutor] optimization: faster than for

2007-06-30 Thread elis aeris
oh yeah, he said getdata() but i don't know where it comes from and image.getpixel((10, 12)) is from http://www.pythonware.com/products/pil/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] optimization: faster than for

2007-06-30 Thread elis aeris
x = 0 y = 0 for x in xrange(1,1024,1): for y in xrange(1,768,1): rgb = image.getpixel((10, 12)) Luke said there is a faster way to do image.getpixel((10, 12)) so i am still waiting on that, the above has been improved many times and it's a lot faster than while, I am trying to find

Re: [Tutor] optimization: faster than for

2007-06-30 Thread Kent Johnson
elis aeris wrote: > my question, is there any other way to make it run faster, > > as described in the webpage, it's possible to use map() but I don't > know how to do it with this one, 2 dimensional arrays. How about number_scanned = 1024 * 768 ? But seriously, the example you gave doesn't do

Re: [Tutor] optimization: faster than for

2007-06-30 Thread elis aeris
my question, is there any other way to make it run faster, as described in the webpage, it's possible to use map() but I don't know how to do it with this one, 2 dimensional arrays. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

Re: [Tutor] optimization: faster than for

2007-06-30 Thread elis aeris
The for version, as claimed by http://www.python.org/doc/essays/list2str.html ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] optimization: faster than for

2007-06-30 Thread Kent Johnson
elis aeris wrote: > I found this on the net, and it's a different arrangement to using for > > the author claims it will result in faster performance, but i can't find > documents on it, because I can't figure out which parts are parameters > and which parts on special words, for python. Where

[Tutor] optimization: faster than for

2007-06-30 Thread elis aeris
I found this on the net, and it's a different arrangement to using for the author claims it will result in faster performance, but i can't find documents on it, because I can't figure out which parts are parameters and which parts on special words, for python. The operations with explicit loop co