Re: Video stream server

2006-12-03 Thread Fredrik Lundh
Lad wrote: > If I use the YOUTUBE.com server , I would have to connect to THEIR > computers whenever a user will come to MY website to play a video > stream on MY website. Is it so? no, your user's browser would have to connect to their computers: http://www.youtube.com/t/help_cat11 b

Re: Video stream server

2006-12-03 Thread Lad
Fredrik, Thank you for your reply. If I use the YOUTUBE.com server , I would have to connect to THEIR computers whenever a user will come to MY website to play a video stream on MY website. Is it so? Regards, L. Lundh wrote: > Lad wrote: > > > Does anybody know about a video stream server

Re: Why not just show the out-of-range index?

2006-12-03 Thread Fredrik Lundh
Russ wrote: >> No one is castigating the OP for bringing up the issue. His suggestion that >> his >> time is worth more than that of anyone else, though, is drawing some ire. > > I'm afraid that any such "suggestion" is purely in your own > imagination. "Now, that would be rather silly. I wo

Re: Why not just show the out-of-range index?

2006-12-03 Thread Russ
Robert Kern wrote: > No one is castigating the OP for bringing up the issue. His suggestion that > his > time is worth more than that of anyone else, though, is drawing some ire. I'm afraid that any such "suggestion" is purely in your own imagination. My time? Do you think I am the only one who

Re: Video stream server

2006-12-03 Thread Fredrik Lundh
Lad wrote: > Does anybody know about a video stream server that > serves up HTML pages with links to video files, and then serving out > those video files. http://www.youtube.com/ seems to match your specification pretty well. -- http://mail.python.org/mailman/listinfo/python-list

Re: About alternatives to Matlab

2006-12-03 Thread Niels L Ellegaard
Jon Harrop wrote: > So I'm keen to learn what Python programmers would want/expect from F# and > OCaml. I think this discussion becoming is a little misguided. The real strength of scipy is the elegant notation rather than speed. Being raised with Matlab I find scipy nicely familiar, and its fast

Video stream server

2006-12-03 Thread Lad
Hello, Does anybody know about a video stream server that serves up HTML pages with links to video files, and then serving out those video files. L. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not just show the out-of-range index?

2006-12-03 Thread Russ
Fredrik Lundh wrote: > Russ wrote: > > > Holy cow! I can't believe that many changes would be necessary unless > > the IndexError exception is scattered all over the place. I would hope > > that one well-placed change could fix the bulk of cases. > > when you write x[i], the interpreter makes no a

Re: Why not just show the out-of-range index?

2006-12-03 Thread Robert Kern
Bill Maxwell wrote: > On Sun, 3 Dec 2006 23:31:56 -0500, Jean-Paul Calderone > <[EMAIL PROTECTED]> wrote: > >> On 3 Dec 2006 17:23:49 -0800, Russ <[EMAIL PROTECTED]> wrote: Rather, they (like I) will encourage to OP to submit a patch that fixes the problem. >>> Now, that would be rather

Re: Why not just show the out-of-range index?

2006-12-03 Thread Fredrik Lundh
Russ wrote: > Holy cow! I can't believe that many changes would be necessary unless > the IndexError exception is scattered all over the place. I would hope > that one well-placed change could fix the bulk of cases. when you write x[i], the interpreter makes no assumptions about x and i and len(

Re: Why not just show the out-of-range index?

2006-12-03 Thread Russ
Dennis Lee Bieber wrote: > OTOH: IndexError is something I seldom see -- most Python statements > are intelligent enough to not need ad hoc indexing. About the only type > that I've seen is just an, almost obvious, off-by-one problem... > > for i in xrange(len(a)): > a[i

algorithm for sorting functional expressions

2006-12-03 Thread chrisguest
I am trying to write some code that will take a list of functional expressions, and order them so that those with primitive terms appear at the beginning of the list and those that are defined by other terms appear last. eg: getSortedEquations(['b = w + z','a = z - y','w = 2*z + v'

RAD for python

2006-12-03 Thread progman
is there a VB-alike tool for python to create forms?? -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not just show the out-of-range index?

2006-12-03 Thread Bill Maxwell
On Sun, 3 Dec 2006 23:31:56 -0500, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >On 3 Dec 2006 17:23:49 -0800, Russ <[EMAIL PROTECTED]> wrote: >> >>> Rather, they (like I) will encourage to OP to submit a patch that fixes the >>> problem. >> >>Now, that would be rather silly. I would have to fa

Re: A mail from Steve Ballmer. See what Microsoft will do and follow.

2006-12-03 Thread James Stroud
JustStand wrote: > For detail, view http://www.homeoftester.com/viewtopic.php?t=281 > __ > I have a dream, I hope I can be as strong as Enter key. Does this pointless blogvertisement in anyway compensate for the fact that windows sucks so hard? James -- James S

Re: Video feature

2006-12-03 Thread Lad
Hello Tim, Thank you for your reply. Yes, my site uses Python. Do you have any idea how to add video playing ( video streaming feature)to my webiste? Thank you for help L. Tim Roberts wrote: > "Lad" <[EMAIL PROTECTED]> wrote: > > > >I would like to add on my website a possibility for visitors to

Re: problem formatting dates from text fields.

2006-12-03 Thread Hendrik van Rooyen
"John Machin" <[EMAIL PROTECTED]> wrote: > Dennis Lee Bieber wrote: 8<-- > > Simplest is probably to do what many web-sites use for credit card > > expiration dates... Ignore any pre-built date-time modules... > > > > Create three integer fields, make

Re: Why not just show the out-of-range index?

2006-12-03 Thread Russ
John Machin wrote: > Perhaps a better analogy is that the OP has observed (correctly IMHO) > that the robes of *all* Pythonistas, including those not yet born and > those not yet converted from heathen languages, could be whiter than > what they are. There are others whose capability to implement

Re: class property methods getting called only once

2006-12-03 Thread limodou
>On 3 Dec 2006 21:24:03 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > In the following code, I could not find out why the set and get methods > are not called once I set the property. > > > >>> class Test: > ... def __init__(self): > ... self._color = 12 > ... def _setcolor(

Re: problem formatting dates from text fields.

2006-12-03 Thread Robert Kern
krishnakant Mane wrote: > is there a soft copy of wxpython in action available for free download? > I saw the book on my book store but since I am totally blind, I have > to depend on soft copies. It is not available for free, no. However, it is available in PDF form from Manning's website: htt

Re: Why not just show the out-of-range index?

2006-12-03 Thread John Machin
Jean-Paul Calderone wrote: > On 3 Dec 2006 17:23:49 -0800, Russ <[EMAIL PROTECTED]> wrote: > > > >> Rather, they (like I) will encourage to OP to submit a patch that fixes > >> the problem. > > > >Now, that would be rather silly. I would have to familiarize myself > >with the code for the Python

class property methods getting called only once

2006-12-03 Thread [EMAIL PROTECTED]
In the following code, I could not find out why the set and get methods are not called once I set the property. >>> class Test: ... def __init__(self): ... self._color = 12 ... def _setcolor(self,value): ... print 'setting' ... self._color = value ... def _getc

Re: problem formatting dates from text fields.

2006-12-03 Thread krishnakant Mane
is there a soft copy of wxpython in action available for free download? I saw the book on my book store but since I am totally blind, I have to depend on soft copies. Krishnakant. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not just show the out-of-range index?

2006-12-03 Thread Gary Herron
Russ wrote: >> Rather, they (like I) will encourage to OP to submit a patch that fixes the >> problem. >> > > Now, that would be rather silly. I would have to familiarize myself > with the code for the Python interpreter, then send a patch to the > maintainers (and hope they notice it in thei

Re: Why not just show the out-of-range index?

2006-12-03 Thread Russ
Jean-Paul Calderone wrote: > And I have some laundry that I would like you to do for me. Let me know > when a convenient time for you to pick it up would be. What that has to do with this thread escapes me, but since you apparently have nothing better to do than track down information that shoul

Re: Python library for reading ODF Spreadsheets

2006-12-03 Thread [EMAIL PROTECTED]
ODT is an XML format, so you can use any XML library, including the one in the default python distribution. It might be zipped XML in which case you will need to uncompress it first. -T John Machin wrote: > On 4/12/2006 10:18 AM, Jonathan Hunt wrote: > > Hi all, > > > > I have had a look on goog

Re: Why not just show the out-of-range index?

2006-12-03 Thread Jean-Paul Calderone
On 3 Dec 2006 17:23:49 -0800, Russ <[EMAIL PROTECTED]> wrote: > >> Rather, they (like I) will encourage to OP to submit a patch that fixes the >> problem. > >Now, that would be rather silly. I would have to familiarize myself >with the code for the Python interpreter, then send a patch to the >mai

Re: Parsing data from pyserial

2006-12-03 Thread John Machin
Si Ballenger wrote: > On 3 Dec 2006 17:33:59 -0800, "John Machin" > <[EMAIL PROTECTED]> wrote: > > >In any case, I wouldn't call that "the appropriate data is being > >received" -- looks like chunks missing to me. > > Well, below is the posted expected return data format from the > cam and below t

Re: About alternatives to Matlab

2006-12-03 Thread George Sakkis
Jon Harrop wrote: > Ok. Perhaps starting a Python JIT in something like MetaOCaml or Lisp/Scheme > would be a good student project? I guess for a student project it's not that important, but if you have higher ambitions, make sure you read http://dirtsimple.org/2005/10/children-of-lesser-python.h

Re: Parsing data from pyserial, an (inefficient) solution

2006-12-03 Thread John Machin
Lone Wolf wrote: Your code has a problem when the first character of reading is 'M': you will miss the full packet and pick up a fragment. The length test that you are doing to reject the fragment is a kludge. If the average length of a packet is say 25, then you are throwing away 4% of all packet

Re: Why not just show the out-of-range index?

2006-12-03 Thread [EMAIL PROTECTED]
John Machin wrote: > [EMAIL PROTECTED] wrote: > > John Machin wrote: > > > Add "Syntax Error: invalid syntax" to the list ... > > > > But at least if you're using IDLE, the point of syntax error > > is highlighted. > > > > Same when using the interactive interpreter, the point of syntax error > is

ANN: UliPad 3.6 released!

2006-12-03 Thread limodou
What's it? It's an Editor based on wxPython. UliPad(NewEdit is the old name) uses Mixin and Plugin technique as its architecture. Most of its classes can be extended via mixin and plugin components, and finally become an integrity class at creating the instance. So UliPad is very dynamic.

Re: Parsing data from pyserial

2006-12-03 Thread Si Ballenger
On 3 Dec 2006 17:33:59 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: >In any case, I wouldn't call that "the appropriate data is being >received" -- looks like chunks missing to me. Well, below is the posted expected return data format from the cam and below that is what has been reported to be

Re: Why not just show the out-of-range index?

2006-12-03 Thread Robert Kern
Russ wrote: >> Rather, they (like I) will encourage to OP to submit a patch that fixes the >> problem. > > Now, that would be rather silly. I would have to familiarize myself > with the code for the Python interpreter, then send a patch to the > maintainers (and hope they notice it in their inbox

Re: Why not just show the out-of-range index?

2006-12-03 Thread John Machin
[EMAIL PROTECTED] wrote: > John Machin wrote: > > Add "Syntax Error: invalid syntax" to the list ... > > But at least if you're using IDLE, the point of syntax error > is highlighted. > Same when using the interactive interpreter, the point of syntax error is highlighted with a caret. However the

Re: trouble with matplotlib

2006-12-03 Thread [EMAIL PROTECTED]
One hack could be to reload the module on each pass. Cheers, -T [EMAIL PROTECTED] wrote: > Hi, > > I am using matplotlib with python to generate a bunch of charts. My > code works fine for a single iteration, which creates and saves 4 > different charts. The trouble is that when I try to run it

Parsing data from pyserial, an (inefficient) solution

2006-12-03 Thread Lone Wolf
I want to thank everybody who tried to help me, and also to post my solution, even though I don’t think it is a very good one. Many of you correctly guessed that there was an “\r” included with the packet from the CUMcam, and you were correct. The actual format of the packet is: M xxx xxx xxx

Re: Why not just show the out-of-range index?

2006-12-03 Thread [EMAIL PROTECTED]
John Machin wrote: > James Stroud wrote: > > Russ wrote: > > > Every Python programmer gets this message occasionally: > > > > > > IndexError: list index out of range > > > > > > The message tells you where the error occurred, but it doesn't tell you > > > what the range and the offending index ar

Re: How to realize the interactive python in Eclipse?

2006-12-03 Thread purple
Thank you for your website. I used to work with the python shell, but it is quite boring in managing the files, so I know the eclipse and pydev. I think I should focus on the documentations first. Thank you very much. > > I am beginning to wonder if you attempting to use PyDev as nothing more > th

Re: Joining data from three different files to be written into three Columns

2006-12-03 Thread Dawn Abbott
Everything works in my program except for when it prints out the number is surrounded by brackets but I need to print the number without the brackets. Does anyone know an easy way to do this? #!/usr/bin/env python import array fin = open('relative_x.INT32','rb') fin1=open('relative_y.INT32','rb')

trouble with matplotlib

2006-12-03 Thread lisa . engblom
Hi, I am using matplotlib with python to generate a bunch of charts. My code works fine for a single iteration, which creates and saves 4 different charts. The trouble is that when I try to run it for the entire set (about 200 items) it can run for 12 items at a time. On the 13th, I get an erro

Re: Parsing data from pyserial

2006-12-03 Thread John Machin
Si Ballenger wrote: > > Per what was posted (below), it appears that the the appropriate > data is being received. [snip] > > Here is an example output: > > M 37 79 3 4 59 124 86 25 > ['59', '123', '87', '25', 'M', '37', '79', '3', '4', '59', > '124', '86', '25', 'M > '] > M 38 77 3 2 59 124 86 25

Re: problem formatting dates from text fields.

2006-12-03 Thread krishnakant Mane
On 04/12/06, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > You don't show us what format is used in the database, so there is > nothing to base a conversion on. Is it year/month/day, month/day/year; > months numeric or alpha (abbreviated or spelled out). Fields separated > by space, comma, -

Re: Why not just show the out-of-range index?

2006-12-03 Thread Russ
> Rather, they (like I) will encourage to OP to submit a patch that fixes the > problem. Now, that would be rather silly. I would have to familiarize myself with the code for the Python interpreter, then send a patch to the maintainers (and hope they notice it in their inboxes), while the mainta

Re: How to realize the interactive python in Eclipse?

2006-12-03 Thread Ravi Teja
purple wrote: > I have installed the Eclipse and the plug-in Pydev. Also, I have add an > python program in the external tools. When I run the python program in > the external tools, i can type python command just like in the python > shell.But when I finished running a python file, in the console

Re: Parsing data from pyserial

2006-12-03 Thread Si Ballenger
On Sun, 03 Dec 2006 18:44:07 -, Grant Edwards <[EMAIL PROTECTED]> wrote: >On 2006-12-03, Si Ballenger <[EMAIL PROTECTED]> wrote: > In my dealing with serial gizmos I have to put a delay between the request sent to the gizmo and the reading of the serial input buffer for returned

Re: Why not just show the out-of-range index?

2006-12-03 Thread Robert Kern
James Stroud wrote: > Russ wrote: >> Every Python programmer gets this message occasionally: >> >> IndexError: list index out of range >> >> The message tells you where the error occurred, but it doesn't tell you >> what the range and the offending index are. Why does it force you to >> determine t

Re: Why not just show the out-of-range index?

2006-12-03 Thread John Machin
James Stroud wrote: > Russ wrote: > > Every Python programmer gets this message occasionally: > > > > IndexError: list index out of range > > > > The message tells you where the error occurred, but it doesn't tell you > > what the range and the offending index are. Why does it force you to > > det

Re: Why not just show the out-of-range index?

2006-12-03 Thread James Stroud
Russ wrote: > Every Python programmer gets this message occasionally: > > IndexError: list index out of range > > The message tells you where the error occurred, but it doesn't tell you > what the range and the offending index are. Why does it force you to > determine that information for yoursel

Why not just show the out-of-range index?

2006-12-03 Thread Russ
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the offending index are. Why does it force you to determine that information for yourself when it could save you a

Re: ftputil upload error

2006-12-03 Thread Mark
On Sat, 02 Dec 2006 04:03:53 -0800, Croteam wrote: > FTPIOError: 550 popravak.txt: Access is denied. Seems pretty self-explanatory to me. M -- http://mail.python.org/mailman/listinfo/python-list

Re: Python library for reading ODF Spreadsheets

2006-12-03 Thread John Machin
On 4/12/2006 10:18 AM, Jonathan Hunt wrote: > Hi all, > > I have had a look on google/freshmeat etc. so please forgive me if I've > missed > an obvious answer. > > Can someone point me to a simple library to read/write ODF spreadsheets (i.e. > OpenOffice Calc 2). I know I can interface with OO

Python library for reading ODF Spreadsheets

2006-12-03 Thread Jonathan Hunt
Hi all, I have had a look on google/freshmeat etc. so please forgive me if I've missed an obvious answer. Can someone point me to a simple library to read/write ODF spreadsheets (i.e. OpenOffice Calc 2). I know I can interface with OOo but this is running on a server where I would rather avoid

Re: About alternatives to Matlab

2006-12-03 Thread Jon Harrop
Carl Banks wrote: >> Optimized Python is 14% slower than badly written OCaml. > > I'd call that roughly the same speed. Did you use any sort of > benchmark suite that miminized testing error, or did you just run it > surrounded by calls to the system timer like I did? System timer, best of three

Re: evaluating gui modules, any experience on tkinter?

2006-12-03 Thread [EMAIL PROTECTED]
Tkinter is lame, but it works everywhere and is what I keep coming back to despite my many complaints about it. If youre application can be fit into a web porgramming framework, that may well be the best way to go. Your browser can probably render a better gui than any of the other frameworks can.

Re: About alternatives to Matlab

2006-12-03 Thread Carl Banks
Jon Harrop wrote: > Carl Banks wrote: > >> 0.56s C++ (direct arrays) > >> 0.61s F# (direct arrays) > >> 0.62s OCaml (direct arrays) > >> 1.38s OCaml (slices) > >> 2.38s Python (slices) > >> 10s Mathematica 5.1 > > [snip] > >> 1.57s Python (in-place) > > > > So, > > optimized Python is roughly the s

Re: Using win32gui.SendMessage and SysListView32 control

2006-12-03 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] schrieb: > Hope someone can steer me in the right direction. > > I am trying to use python to collect the values from a Win32 > application's control. > I can successfull query an retreive the values ListBox, Edit and > Buttons, however, the application uses a control called a >

Interface Designer

2006-12-03 Thread Murdok Petrovsky
Hi list! I'm starting to program in python, i need a soft "interface designer" and adapt this interface to python. Somebody can help me with this? Sorry, my english is very bad. Regards to all. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem formatting dates from text fields.

2006-12-03 Thread John Machin
Dennis Lee Bieber wrote: > On Mon, 4 Dec 2006 01:11:30 +0530, "krishnakant Mane" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > I am tired searching for some good tutorial that can explain the basic > > functionality of wx.datetime class and the datetime picker. > > I wan

Re: Using win32gui.SendMessage and SysListView32 control

2006-12-03 Thread Neil Hodgson
[EMAIL PROTECTED]: > This page seems to imply that the control can be queried with messages, > however, my problem seems to be that pywin32.win32con does not define a > constant for the LVM series of messages. These are defined in win32/lib/commctrl.py in my installation. Neil -- http:/

Thread error

2006-12-03 Thread Salvatore Di Fazio
Hi guys, when I close the application I get the following error: - Traceback (most recent call last): File "main.py", line 88, in while exit : pass KeyboardInterrupt Unhandled exception in thread started by Error in sys.excepthook: Original exception was: --

Re: please provide urls for some python success stories.

2006-12-03 Thread Mohammad Tayseer
Hello Krishnakant There is a book "Python success stories". Download the 2 volumes from here http://pythonology.org/success If you want to convince java programmers to use python, show them this presentation from PyCon2003 "The seven habits of highly effective technology disruption" www.infoethe

Re: Deleting from a list while iterating

2006-12-03 Thread Martin v. Löwis
Rhamphoryncus schrieb: >> This is different from the other approaches in that it doesn't >> modify items. If you wanted a new list, you could incrementally >> build one already in the first pass, no need to collect the >> indices first (as BlackJack explains). > > I didn't feel this distinction wa

Using win32gui.SendMessage and SysListView32 control

2006-12-03 Thread geskerrett
Hope someone can steer me in the right direction. I am trying to use python to collect the values from a Win32 application's control. I can successfull query an retreive the values ListBox, Edit and Buttons, however, the application uses a control called a 'SysListView32' Control. MSDN says that

Re: About alternatives to Matlab

2006-12-03 Thread Jon Harrop
Carl Banks wrote: >> 0.56s C++ (direct arrays) >> 0.61s F# (direct arrays) >> 0.62s OCaml (direct arrays) >> 1.38s OCaml (slices) >> 2.38s Python (slices) >> 10s Mathematica 5.1 > [snip] >> 1.57s Python (in-place) > > So, > optimized Python is roughly the same speed as naive Ocaml > optimized Ocam

please provide urls for some python success stories.

2006-12-03 Thread krishnakant Mane
hello all. actually I have been recently appointed as a technology consulltent at a huge company. and I have couple more such projects in the pypeline. unfortunately the officials out here are too much in favour of java and I have personally worked with both and find that python is heaven in syntax

problem formatting dates from text fields.

2006-12-03 Thread krishnakant Mane
hello all. thanks for the help and for pointing me to the proper url for wxpython related issues. I am so happy that I now have a very easy gui library that can do practically every thing with such ease (no flames intended but I was never at so much ease with java swing ). I however have a problem

Re: Parsing data from pyserial

2006-12-03 Thread Grant Edwards
On 2006-12-03, John Machin <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > >> When something odd seems to be happening with strings, always >> print `whatever` rather than whatever >> > >:-) > > Unholy perlism, Batman! OK, make that "print repr(whatever)". :) -- Grant Edwards

Re: Parsing data from pyserial

2006-12-03 Thread Fredrik Lundh
Si Ballenger wrote: > I would think a time delay would be needed between the below two > lines in the code if he expects to get a useable data string back > from the gizmo for the command sent to it. > > ser.write("TC 016 240 100 240 016 240\r\n") > reading = ser.read(40) why's that? if t

Re: Parsing data from pyserial

2006-12-03 Thread Grant Edwards
On 2006-12-03, Si Ballenger <[EMAIL PROTECTED]> wrote: >>> In my dealing with serial gizmos I have to put a delay between >>> the request sent to the gizmo and the reading of the serial input >>> buffer for returned data. Serial ports and gizmos need some time >>> to do their thing. >> >>I doubt t

Re: Parsing data from pyserial

2006-12-03 Thread John Machin
Grant Edwards wrote: > When something odd seems to be happening with strings, always > print `whatever` rather than whatever > :-) Unholy perlism, Batman! For the benefit of gentle readers who are newish and might not have seen the ` character in Python code outside a string literal, or for tho

Re: Parsing data from pyserial

2006-12-03 Thread Si Ballenger
On Sun, 03 Dec 2006 16:52:33 -, Grant Edwards <[EMAIL PROTECTED]> wrote: >On 2006-12-03, Si Ballenger <[EMAIL PROTECTED]> wrote: > >> In my dealing with serial gizmos I have to put a delay between >> the request sent to the gizmo and the reading of the serial input >> buffer for returned data.

Re: wxpython worked out but can't find api docs for download.

2006-12-03 Thread cptnwillard
Sorry, I think all you want is "wxPython-newdocs", which is the wxPython-specific documentation. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython worked out but can't find api docs for download.

2006-12-03 Thread cptnwillard
Go to: http://wxpython.org/download.php#binaries and in the documentation part, download both "wxPython-docs" and "wxPython-newdocs". Hope this helps. -- http://mail.python.org/mailman/listinfo/python-list

Re: About alternatives to Matlab

2006-12-03 Thread Carl Banks
Jon Harrop wrote: > I had thought that all of the array operations were allocating new arrays at > first but it seems that at least assignment to a slice does not. > > Does: > > a[:] = b[:] + c[:] > > allocate a temporary for b[:] + c[:]? Yep. [snip] > Not only is that shorter than the Python,

Re: text adventure question

2006-12-03 Thread Joe Peterson
On 2006-12-02, Ara Kooser wrote: > I am working on a text adventure game for python to get back > into python programming. My version 0.1 used only functions so > I could get familiar with how those work. I want to move beyond > that. I am not sure what would be a good Python way of handling > thi

Re: A mail from Steve Ballmer. See what Microsoft will do and follow.

2006-12-03 Thread Stefan Scholl
JustStand <[EMAIL PROTECTED]> wrote: > In many ways, it was the launch of Windows 95 and Office 95 eleven > years ago that signaled the start of this transformation. ..." Right. 11 years ago I switched from Amiga to Linux. -- Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/

Re: About alternatives to Matlab

2006-12-03 Thread Jon Harrop
Carl Banks wrote: >> fill a (map3 (fun b c d -> b + c + d) b c d) >> >> which will be much faster because it doesn't generate an intermediate >> array. > > Ah, but, this wasn't about temporaries when you spoke of "eagerly > allocating arrays", was it? I had thought that all of the array operati

Re: Parsing data from pyserial

2006-12-03 Thread Grant Edwards
On 2006-12-03, Si Ballenger <[EMAIL PROTECTED]> wrote: > In my dealing with serial gizmos I have to put a delay between > the request sent to the gizmo and the reading of the serial input > buffer for returned data. Serial ports and gizmos need some time > to do their thing. I doubt that's the is

Re: best way to align words?

2006-12-03 Thread Robert R.
Oleg Batrashev a écrit : > This means that if you have 10 sentences with 5 words in each there is > 5^10 space and time complexity. Definitelly, there are better > algorithms from dynamic programming, but you should review your needs: > how many sentences, words you have. it can be few to many,

Re: Deleting from a list while iterating

2006-12-03 Thread Rhamphoryncus
Martin v. Löwis wrote: > Rhamphoryncus schrieb: > > setapproach = """\ > > def func(count): > > from random import random > > items = [random() for i in xrange(count)] > > remove = set() > > for index, x in enumerate(items): > > #...do something... > > if x < 0.5: >

Re: Deleting from a list while iterating

2006-12-03 Thread Fredrik Lundh
Rhamphoryncus wrote: > Sorry, I should have clarified that the original post assumed you > needed info from the "do something" phase to determine if an element is > removed or not. As you say, a list comprehension is superior if that > is not necessary. that's spelled out = [] for i i

Re: Deleting from a list while iterating

2006-12-03 Thread Fredrik Lundh
Marc 'BlackJack' Rintsch wrote: > No need to iterate twice over the `items`. The two other approaches you > gave are just needed if it's important that the elements are deleted "in > place", i.e. that you don't rebind `items` to a new object. and even when you do, that can often be written as, e

Re: Deleting from a list while iterating

2006-12-03 Thread Rhamphoryncus
Marc 'BlackJack' Rintsch wrote: > Why do you make it that complicated? If you are going to build a new list > anyway, this can be done without the `set()` and just one listcomp: Fredrik Lundh wrote: > your set approach doesn't modify the list in place, though; it creates > a new list, in a rather

Re: Deleting from a list while iterating

2006-12-03 Thread Martin v. Löwis
Rhamphoryncus schrieb: > setapproach = """\ > def func(count): > from random import random > items = [random() for i in xrange(count)] > remove = set() > for index, x in enumerate(items): > #...do something... > if x < 0.5: > remove.add(index) > items

Re: Deleting from a list while iterating

2006-12-03 Thread Fredrik Lundh
Fredrik Lundh wrote: > on my machine, that's about two orders of magnitude faster than your > "fast" approach for n=10. oops. forget that; it's three times faster, if you're actually creating the entire list, and not just a generator that will create it on demand ;-) -- http://mail.pyt

Re: About alternatives to Matlab

2006-12-03 Thread Carl Banks
Jon Harrop wrote: > >> In particular, I think you are eagerly > >> allocating arrays when, in a functional language, you could just as > >> easily compose closures. > > > > You are completely wrong. > > I'll give an example. If you write the Python: > > a[:] = b[:] + c[:] + d[:] > > I think that

Re: Deleting from a list while iterating

2006-12-03 Thread Fredrik Lundh
Rhamphoryncus wrote: > As you can see, although reverse iteration is somewhat faster at > smaller sizes, a set is substantially faster at larger sizes, and I > believe is more readable anyway. your set approach doesn't modify the list in place, though; it creates a new list, in a rather roundabou

Re: Deleting from a list while iterating

2006-12-03 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Rhamphoryncus wrote: > My approach is to make a set of indexes to removed while iterating, > then use a list comprehension to filter them out after. Timings of > this and two other common approaches follow: > > setapproach = """\ > def func(count): > from random impor

Re: twisted problem with reactor.stop()

2006-12-03 Thread Jean-Paul Calderone
On 3 Dec 2006 03:16:44 -0800, [EMAIL PROTECTED] wrote: >hello, everyone >I use twisted 1.3 in my python application. >in my program, I have one server and on client running at same time (so >2 reactor.run(installSignalHandlers=0) ) >the client run in one thread and the server in an other thread ( >

Deleting from a list while iterating

2006-12-03 Thread Rhamphoryncus
The problems of this are well known, and a suggestion for making this easier was recently posted on python-dev. However, I believe this can be done just as well without a change to the language. What's more, most of the suggested methods (in my search results as well as the suggestion itself) do

Re: How to realize the interactive python in Eclipse?

2006-12-03 Thread purple
Thanks so much for your concern~~ In the preferences for pydev, I have added the python.exe in the python interpreters, and also the system PYTHONPATH, Forced built-in libs. I am not sure whether you mean it? I am sorry because I am a green hand on the eclipse. And for the external tools, I have

Re: Parsing data from pyserial

2006-12-03 Thread Si Ballenger
On Sat, 2 Dec 2006 23:02:06 -0500, Lone Wolf <[EMAIL PROTECTED]> wrote: >I'm trying to get data through my serial port from a CMUcam. >This gizmo tracks a color and returns a packet of data. The >packet has nine data points (well, really eight since the first >point is just a packet header) separa

Re: cursor.executemany() float error

2006-12-03 Thread progman
i am using mysql i tried the cursor.executemany('insert into promo (`From`,`To`, `RATE`) \ values (%s,%s,%s)', [ ('AA','BB',10.2), ('CC','DD',10.3) ] ) and it works. very strange. isn't it? Fredrik Lundh wrote: > progman wrote: > > > cursor.executemany('insert into promo (`From`,`To`, `

Re: cursor.executemany() float error

2006-12-03 Thread Fredrik Lundh
progman wrote: > cursor.executemany('insert into promo (`From`,`To`, `RATE`) \ > values (%s,%s,%f)', [ ('AA','BB',10.2), ('CC','DD',10.3) ] ) > > i got this error: > TypeError: float argument required > > i checked, 10.2 & 10.3 , there are at the right loc. > what went wrong?? posting a bit mo

Re: Resource cleanup

2006-12-03 Thread Robin Becker
Diez B. Roggisch wrote: ... >> >> I have a vague feeling that I came across problems in the past about >> the order in which modules were finalized. > > I'm a bit on unsure ground here - so take it with a grain of salt. > > It is for sure that only executing code will refer to a global - the

Re: Parsing data from pyserial

2006-12-03 Thread Grant Edwards
On 2006-12-03, Lone Wolf <[EMAIL PROTECTED]> wrote: > import serial > > ser=serial.Serial('com1',baudrate=115200, bytesize=8, > parity='N', stopbits=1,xonxoff=0, timeout=1) > > ser.write("PM 1") #This sets the CMUcam to poll mode > > for i in range(0,100,1): > ser.write("TC 016 240 100 240 0

cursor.executemany() float error

2006-12-03 Thread progman
Data Struct: from (string), to (string), rate (float) when i run this: cursor.executemany('insert into promo (`From`,`To`, `RATE`) \ values (%s,%s,%f)', [ ('AA','BB',10.2), ('CC','DD',10.3) ] ) i got this error: TypeError: float argument required i checked, 10.2 & 10.3 , there are at the right

Re: Resource cleanup

2006-12-03 Thread Diez B. Roggisch
> but am wondering exactly what 'resources' are left available when the > r.close method is called in the __del__ method of RealTypeResourceCleaner. > > In particular, can I rely on the module globals of r still being present > if the RealType instance is going away because the main script has

Re: How to realize the interactive python in Eclipse?

2006-12-03 Thread kilnhead
purple wrote: > I have installed the Eclipse and the plug-in Pydev. Also, I have add an > python program in the external tools. When I run the python program in > the external tools, i can type python command just like in the python > shell.But when I finished running a python file, in the console

  1   2   >