Re: Clearing the screen

2006-02-12 Thread mwt
No guessing needed. If I just use os.system("clear") on its own, no problem. Also, if I use the magic formula you gave on its own, that works to. But in the app, (see below), neither command works. I'm missing something obvious, but I'm... missing it. def run(self, userinfo): """Time when

Re: Shortest prime number program

2006-02-12 Thread Tim Hochberg
While not nearly the shortest proposed thus far, I'm fond of: from itertools import count, ifilter def sieve(s=count(2)): while 1:p=s.next();s=ifilter(p.__rmod__,s);yield p It will generate quite a large number of primes before blowing up (at least 50,000 primes, p=611,957) and it's much fast

Re: Clearing the screen

2006-02-12 Thread mwt
Arrgghh... Is there any way to edit posts on this thing? The os.system("clear") doesn't work at all in a module. -- http://mail.python.org/mailman/listinfo/python-list

Re: PySizeof: almost useful

2006-02-12 Thread MrJean1
Check the sizeof() method in the mxTools package from eGenix: /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: Shortest prime number program

2006-02-12 Thread Christoph Zwerschke
Tim Hochberg wrote: > from itertools import count, ifilter > def sieve(s=count(2)): > while 1:p=s.next();s=ifilter(p.__rmod__,s);yield p Nice! -- Christoph -- http://mail.python.org/mailman/listinfo/python-list

Re: Single-file executables

2006-02-12 Thread Giovanni Bajo
Ravi Teja wrote: > Actually, py2exe (from version 0.6.1) onwards does create single file > exes without ANY additional dependencies. They still require an external MSVCR71.DLL if made with Python 2.4. PyInstaller 1.1 (to be released today) does not have this problem. -- Giovanni Bajo -- http:

PEP 353: Using ssize_t as the index type

2006-02-12 Thread Martin v. Löwis
I've been working on PEP 353 for some time now. Please comment, in particular if you are using 64-bit systems. Regards, Martin PEP: 353 Title: Using ssize_t as the index type Version: $Revision: 42333 $ Last-Modified: $Date: 2006-02-12 10:36:52 +0100 (So, 12 Feb 2006) $ Author: Martin v. Löwis <[

Re: Pyserial handobook

2006-02-12 Thread Zarathustra
Maybe I does not see very well, I'm sorry, but at my ome I have only the dial up connection :-))) Thank you very much for the help -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python very slow compared to C

2006-02-12 Thread bearophileHUGS
Steven D'Aprano>Very slow to do what, compared to what? The decay time of the tau meson?< Probably every answer I can give you is wrong for you, so answering is almost useless... In this thread we have already given the most pertinent answers to the original question from Diffuse. I can show you t

Re: Is python very slow compared to C

2006-02-12 Thread bonono
[EMAIL PROTECTED] wrote: > Steven D'Aprano>Very slow to do what, compared to what? The decay time > of the tau meson?< > > Probably every answer I can give you is wrong for you, so answering is > almost useless... In this thread we have already given the most > pertinent answers to the original qu

Re: by reference

2006-02-12 Thread Bruno Desthuilliers
dirvine a écrit : > Thanks but I am a bit unsure as to what error I have made by posting > this question. Your question was not very clear. > I am not trying to be funny but can you give me a > pointer to the issue. Have you read Martin Hellwig's answer ? -- http://mail.python.org/mailman/lis

Re: Is python very slow compared to C

2006-02-12 Thread Felipe Almeida Lessa
Em Dom, 2006-02-12 às 03:03 -0800, [EMAIL PROTECTED] escreveu: > Probably every answer I can give you is wrong for you, so answering is > almost useless... In this thread we have already given the most > pertinent answers to the original question from Diffuse. > I can show you this page, but I thin

Re: Is python very slow compared to C

2006-02-12 Thread Felipe Almeida Lessa
Em Dom, 2006-02-12 às 03:20 -0800, [EMAIL PROTECTED] escreveu: > However, to me, the strength of python is the batteries that is > included(and there are more and more coming). So .NET is as good as Python? Hmmm... I think the language itself is the best part of Python, its library is just a compl

Re: Is python very slow compared to C

2006-02-12 Thread Jarek Zgoda
[EMAIL PROTECTED] napisał(a): > I have just started to learn python. Some said that its slow. Can > somebody pin point the issue. So what? If you want fast code, go with assembly. -- Jarek Zgoda http://jpa.berlios.de/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python very slow compared to C

2006-02-12 Thread bonono
Felipe Almeida Lessa wrote: > Em Dom, 2006-02-12 às 03:20 -0800, [EMAIL PROTECTED] escreveu: > > However, to me, the strength of python is the batteries that is > > included(and there are more and more coming). > > So .NET is as good as Python? Hmmm... I think the language itself is the > best par

Re: Single-file executables

2006-02-12 Thread Peter Hansen
Giovanni Bajo wrote: > Ravi Teja wrote: >>Actually, py2exe (from version 0.6.1) onwards does create single file >>exes without ANY additional dependencies. > > They still require an external MSVCR71.DLL if made with Python 2.4. > PyInstaller > 1.1 (to be released today) does not have this problem

Re: two generators working in tandem

2006-02-12 Thread Anton Vredegoor
Michael Spencer wrote: > This returns an iterator that 'nests' an arbitrary number of sequences > (odometer-style). > > def nest(*sequences): > def _nest(outer, inner): > for outer_item in outer: > if not isinstance(outer_item, tuple): > outer_item = (o

Re: Is python very slow compared to C

2006-02-12 Thread Felipe Almeida Lessa
Em Dom, 2006-02-12 às 04:33 -0800, [EMAIL PROTECTED] escreveu: > Felipe Almeida Lessa wrote: > > Em Dom, 2006-02-12 às 03:20 -0800, [EMAIL PROTECTED] escreveu: > > > However, to me, the strength of python is the batteries that is > > > included(and there are more and more coming). > > > > So .NET i

Tracking down memory leaks?

2006-02-12 Thread MKoool
I have an application with one function called "compute", which given a filename, goes through that file and performs various statistical analyses. It uses arrays extensively and loops alot. it prints the results of it's statistical significance tests to standard out. Since the compute function

Re: Is there any books such as 'effective python' or else about the performance?

2006-02-12 Thread gene tani
Kenneth Xie wrote: > att, thx. Start here. http://www.python.org/moin/PythonSpeed/PerformanceTips http://trific.ath.cx/resources/python/optimization/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Tracking down memory leaks?

2006-02-12 Thread Felipe Almeida Lessa
Em Dom, 2006-02-12 às 05:11 -0800, MKoool escreveu: > I have an application with one function called "compute", which given a > filename, goes through that file and performs various statistical > analyses. It uses arrays extensively and loops alot. it prints the > results of it's statistical sign

Re: Is python very slow compared to C

2006-02-12 Thread Luis M. González
Steven D'Aprano wrote: > What is slow? Slow compared to what? Would you prefer to spend three days > writing a program that will run in twenty milliseconds, or three hours > writing the same program which runs in eighty milliseconds? Is the > computer's execution time more important than your deve

Re: Is python very slow compared to C

2006-02-12 Thread Björn Lindström
Felipe Almeida Lessa <[EMAIL PROTECTED]>: > In the case of Python, as well as Java, the language has the same > name as the framework, and this may have lead you to mistake me. Not really, in either case. There's Python for both .NET and for the Java VM. -- Björn Lindström <[EMAIL PROTECTED]> S

Re: Jython socket typecasting problems

2006-02-12 Thread Kent Johnson
Mark Fink wrote: > The cast to Integer for the port does not work either: > > D:\AUT_TEST\workspace\JyFIT>jython fit/JyFitServer2.py "" 1234 23 > ['fit/JyFitServer2.py', '', '1234', '23'] > > Traceback (innermost last): > File "fit/JyFitServer2.py", line 146, in ? > File "fit/JyFitServer2.py"

Re: Is python very slow compared to C

2006-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2006 03:03:20 -0800, bearophileHUGS wrote: > Steven D'Aprano>Very slow to do what, compared to what? The decay time > of the tau meson?< > > Probably every answer I can give you is wrong for you, so answering is > almost useless... We do actually agree. You did explain why the sp

Re: Is python very slow compared to C

2006-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2006 05:31:28 -0800, =?iso-8859-1?q?Luis_M._Gonz=E1lez?= wrote: > You are right, we all know that, but I think the person who asked this > question doesn't want to hear a sales pitch. He asked a very specific > question regarding execution speed. Read his post again. He didn't ask

Re: is there a better way?

2006-02-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Problem: > > You have a list of unknown length, This doesn't exist in Python: len(alist) > such as this: list = > [X,X,X,O,O,O,O]. You want to extract all and only the X's. braindead solution - relying on zeros being zeros or any other False value: all_xxx = fi

Re: Is python very slow compared to C

2006-02-12 Thread bonono
Steven D'Aprano wrote: > But, in general, more often than not, Python is fast enough. The extra > value of using something like Lua or Ocaml or even C is just not enough to > make up for the disadvantages of using those languages. > What is the disavantage of Lua comparing with Python ? Or Ocaml c

Re: Tracking down memory leaks?

2006-02-12 Thread [EMAIL PROTECTED]
I *think* Python uses reference counting for garbage collection. I've heard talk of people wanting to change this (to mark and sweep?). Anyway, Python stores a counter with each object. Everytime you make a reference to an object this counter is increased. Everytime a pointer to the object is de

Re: Tracking down memory leaks?

2006-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2006 05:11:02 -0800, MKoool wrote: > I have an application with one function called "compute", which given a > filename, goes through that file and performs various statistical > analyses. It uses arrays extensively and loops alot. it prints the > results of it's statistical signi

ANN: PyGUI 1.6

2006-02-12 Thread greg
PyGUI 1.6 is now available: http://www.cosc.canterbury.ac.nz/~greg/python_gui/ The major change in this version is that the Mac version is based on Cocoa instead of Carbon. This should provide a much better base for future development, but it does mean that MacOSX will now be required. (This i

Re: breaking from loop

2006-02-12 Thread Peter Otten
Ritesh Raj Sarraf wrote: > def copy_first_match(repository, filename, dest_dir): # aka > walk_tree_copy() > for path, file in files(repository): > if file == filename: > try: > shutil.copy(os.path.join(path, file), dest_dir) > sys.stdout.writ

Re: Tracking down memory leaks?

2006-02-12 Thread Fredrik Lundh
"[EMAIL PROTECTED]" wrote: > I'm not an expert on python internals, and it is possible that they > have a way of checking for cases like this. I think the deepcopy > method catches this, but I don't *think* basic garbage collection look > for this sort of thing. http://www.python.org/doc/faq/ge

Re: Tracking down memory leaks?

2006-02-12 Thread [EMAIL PROTECTED]
MKoool wrote: > I have an application with one function called "compute", which given a > filename, goes through that file and performs various statistical > analyses. It uses arrays extensively and loops alot. it prints the > results of it's statistical significance tests to standard out. Sinc

Re: Is python very slow compared to C

2006-02-12 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Luis M. González <[EMAIL PROTECTED]> wrote: . . . >> Python helps you write shorter code with fewer bugs, much quicker, than C. >> If you discover a specific problem that runs too slow in Python,

Re: Is python very slow compared to C

2006-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2006 06:20:10 -0800, bonono wrote: > > Steven D'Aprano wrote: >> But, in general, more often than not, Python is fast enough. The extra >> value of using something like Lua or Ocaml or even C is just not enough to >> make up for the disadvantages of using those languages. >> > What

Can I get the 8bit-string representation of any unicode string

2006-02-12 Thread wanghz
Hello, everyone. I have a problem when I'm processing unicode strings. Is it possible to get the 8bit-string representation of any unicode string? Suppose I get a unicode string: a = u'\xc8\xce\xcf\xcd\xc6\xeb'; then, by a.encode('latin-1'); I can get the 8bit-string representation of it, th

Re: Tracking down memory leaks?

2006-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2006 06:01:55 -0800, [EMAIL PROTECTED] wrote: > I *think* Python uses reference counting for garbage collection. Yes it does, with special code for detecting and collecting circular references. > I've > heard talk of people wanting to change this (to mark and sweep?). Reference c

Re: Can I get the 8bit-string representation of any unicode string

2006-02-12 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hello, everyone. > > I have a problem when I'm processing unicode strings. Is it possible > to get the 8bit-string representation of any unicode string? Yes, if you can be more precise about what you mean by '8bit-string representation'. Likely candidates are b.encode

Re: Is python very slow compared to C

2006-02-12 Thread bonono
Steven D'Aprano wrote: > Lua appears to be *too* lightweight, without even classes or inheritance, > and a single data type where Python has dicts, sets, tuples and lists. > I believe Lua does have features to implement class/inheritance. As for the distinction of dict/set/tuple/list or one singl

Re: Can I get the 8bit-string representation of any unicode string

2006-02-12 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I have a problem when I'm processing unicode strings. Is it possible > to get the 8bit-string representation of any unicode string? > > Suppose I get a unicode string: > a = u'\xc8\xce\xcf\xcd\xc6\xeb'; > then, by > a.encode('latin-1'); > I can get the 8bit-string r

Re: appending to a list via properties

2006-02-12 Thread Peter Otten
[Alex Martelli] > If you want to hoist for performance, you can hoist more: > > appenders = foo.append, qux.append > while some_condition: > for appender, anitem in zip(appenders, calculate_something()): > appender(anitem) You are of course claiming a performance improvement over Car

Re: Is python very slow compared to C

2006-02-12 Thread diffuser78
Thnaks everybody for their comments. I am an average programmer in C and wanted to make a hop to python and was just trying to clear my mind with the confusions. Bit I guess I will go ahead and spend some time with python and do my next project in python. thanks for the feedback -- http://mail.

Newbie

2006-02-12 Thread LittlePython
Is this a good place to post python questions from newbie's, or would you suggest another board? Thx -- http://mail.python.org/mailman/listinfo/python-list

Re: Netstat in python. Does it's possible?

2006-02-12 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Martin v. Löwis <[EMAIL PROTECTED]> wrote: >Jorgen Grahn wrote: >> There might still be a problem for people doing things like this: netstat >> might use unstable or non-public APIs to find the things it lists. This is >> fine because it's typically your OS vendor wh

Re: Can I get the 8bit-string representation of any unicode string

2006-02-12 Thread wanghz
Thank you all for your replies :-) I may misunderstood it. I will think about it carefully. By the way, does python has a interface, just like iconv in libc for C/C++? Or, how can I convert a string from a encoding into another one? Thank you so much. -- http://mail.python.org/mailman/listi

Re: Can I get the 8bit-string representation of any unicode string

2006-02-12 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote > I may misunderstood it. I will think about it carefully. > > By the way, does python has a interface, just like iconv in libc for > C/C++? Or, how can I convert a string from a encoding into another > one? if b is an 8-bit string containing an encoded unicode string,

Re: Legality of using Fonts

2006-02-12 Thread garabik-news-2005-05
Kamilche <[EMAIL PROTECTED]> wrote: > Yeah, that's what I'm thinking, as well. Showing all the text on an > image is one thing... using that image as the basis of a font engine is > something different. > > Luckily, someone has sent me a link to a set of free TrueType fonts - > http://www.gnome.or

Re: RPy / R

2006-02-12 Thread Eddie
R = 2.2.1 Rpy = rpy-0.4.6-R-2.0.0-to-2.2.1-py24.win32.exe Active Python = ActivePython-2.4.2.10-win32-x86.msi Numeric = Numeric-24.2.win32-py2.4.exe NumPy = numpy-0.9.4.win32-py2.4.exe I don't believe I have installed SciPy The Numeric and NumPy differences are explained at http://numeric.scipy.or

Re: ANN: PyGUI 1.6

2006-02-12 Thread Kevin Walzer
greg wrote: > PyGUI 1.6 is now available: > > http://www.cosc.canterbury.ac.nz/~greg/python_gui/ > > The major change in this version is that the Mac version > is based on Cocoa instead of Carbon. This should provide a > much better base for future development, but it does mean > that MacOSX wi

Re: Newbie

2006-02-12 Thread Bruno Desthuilliers
LittlePython a écrit : > Is this a good place to post python questions from newbie's, or would you > suggest another board? Well, depends on how newbie you are, both to Python and to programming, but yes, this is at least a good place to start. You may find that most other newsgroups are probabl

Re: Is python very slow compared to C

2006-02-12 Thread PA
On Feb 12, 2006, at 16:11, Steven D'Aprano wrote: > availability of skilled programmers is absolutely critical for the use > of a language. By that measure, we should all be using Java, no? "TIOBE Programming Community Index" http://www.tiobe.com/tpci.htm > By comparison, even Forth gives 13

Re: Newbie

2006-02-12 Thread Gary Herron
LittlePython wrote: >Is this a good place to post python questions from newbie's, or would you >suggest another board? >Thx > > This is the correct place. This group has the reputation of being newbie-friendly. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie

2006-02-12 Thread epost2
This is a good place for posting questions about programming in python. However, if you are a newbie, your questions are most likely already answered. I recommend searching in this groups archives reading the python tutorial http://docs.python.org/tut/tut.html reading http://www.byteofpython.inf

Re: Newbie

2006-02-12 Thread LittlePython
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > LittlePython a écrit : > > Is this a good place to post python questions from newbie's, or would you > > suggest another board? > > Well, depends on how newbie you are, both to Python and to programming, > but yes,

Is Forth for real?

2006-02-12 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: . . . >on the web for each language. By comparison, even Forth gives 13 million >plus hits, and who uses Forth? .

Re: Newbie

2006-02-12 Thread LittlePython
I am very new to python. I have been studying it for only a month or so. I have been using vbscript for about 2-3 yrs and only recently been using it rather heavily the past 9 months or so. I am new very new to oop. My main use will be administrative scripting into the win3k, XP, AD domain, 55excha

Re: Is python very slow compared to C

2006-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2006 17:44:50 +0100, PA wrote: > On Feb 12, 2006, at 16:11, Steven D'Aprano wrote: > >> availability of skilled programmers is absolutely critical for the use >> of a language. > > By that measure, we should all be using Java, no? I said nothing about whether Lua or Ocaml were g

Re: Is python very slow compared to C

2006-02-12 Thread PA
On Feb 12, 2006, at 18:18, Steven D'Aprano wrote: > Did you actually bother to read the page you linked to? I did 8^) "Lua — Story of O" http://alt.textdrive.com/lua/19/lua-story-of-o Cheers -- PA, Onnay Equitursay http://alt.textdrive.com/ -- http://mail.python.org/mailman/listinfo/python-

Re: Is Forth for real?

2006-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2006 17:08:02 +, Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > . > . > . >>on the web for each language. By comparison, even Forth gives 13 million >>plus h

Re: Is Forth for real?

2006-02-12 Thread Roy Smith
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I love Forth. I'm no good at thinking at that low count-the-bytes level, > but if I was, I'd much prefer to use Forth than C or assembly. I've got a > bunch of Forth books here, and when I'm bored I read them for > entertainment, and dream. I love the f

Re: Tracking down memory leaks?

2006-02-12 Thread gene tani
[EMAIL PROTECTED] wrote: > MKoool wrote: > > I have an application with one function called "compute", which given a > > filename, goes through that file and performs various statistical > > analyses. It uses arrays extensively and loops alot. it prints the > > results of it's statistical signif

Re: Is Forth for real?

2006-02-12 Thread skip
Roy> If you like Forth, take a look at PostScript. I miss NeWS... :-( Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check...

2006-02-12 Thread Scott David Daniels
Lad wrote: > Hello, > How can I check that a string does NOT contain NON English characters? > Thanks > L. > If all you care about is ASCII vs. non-ASCII, you could use: ord(max(string)) < 128 -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Tracking down memory leaks?

2006-02-12 Thread [EMAIL PROTECTED]
>> I'm not an expert on python internals, and it is possible that they have >> a way of checking for cases like this. I think the deepcopy method >> catches this, but I don't *think* basic garbage collection look for this >> sort of thing. > > deepcopy has nothing to do with garbage collection. >

Re: problem with opening Python IDLE

2006-02-12 Thread [EMAIL PROTECTED]
Bennie Tilma wrote: > I'm having trouble with opening the python IDLE-program. When I try to start > it, it gives an errormessage wich states that it can not make a connection, > possibly because of a firewall. However, adding it to firewalls exeptions or > even disabeling the firewall has no effe

Re: Tracking down memory leaks?

2006-02-12 Thread Jean-Paul Calderone
On 12 Feb 2006 10:13:02 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >>> I'm not an expert on python internals, and it is possible that they have >>> a way of checking for cases like this. I think the deepcopy method >>> catches this, but I don't *think* basic garbage collection look for

Re: Can I get the 8bit-string representation of any unicode string

2006-02-12 Thread wanghz
Hi, I see. Thank you for your help! Regards, hongzheng Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote > > > I may misunderstood it. I will think about it carefully. > > > > By the way, does python has a interface, just like iconv in libc for > > C/C++? Or, how can I convert a string from a e

Re: Is python very slow compared to C

2006-02-12 Thread Michael Tobis
> Read his post again. He didn't ask a specific question at all, and he > certainly didn't mention execution speed. agreed > He asked a vague, meaningless question about whether Python was "slow > compared to C". No, that is both wrong and gratuitously harsh. He had heard vague meaningless com

Re: Too Many if Statements?

2006-02-12 Thread slogging_away
Now that I know the root cause of the problem, I can write around it as suggested by Steve Holden and Terry Reedy, (and others). In fact, it has helped me in a way as I am thinking not in terms of the easiest solution, (read; the first one that comes to mind), but more effcient and cleaner ways t

Re: Too Many if Statements?

2006-02-12 Thread Bengt Richter
On Sat, 11 Feb 2006 15:40:49 -0500, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >"Steve Holden" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Clearly it would be a good idea to remove whatever problem is causing >> the error, > >The problem (see my post of the com_backpatch code)

Re: Tracking down memory leaks?

2006-02-12 Thread malv
Hi Steven, Is there any way for making Python return memory no longer needed to the OS? Cases may arise where you indeed need a big memory block temporarily without being able to split it up into smaller chunks. Thank you. malv Steven D'Aprano wrote: > Objects return memory to Python when they a

Re: Is python very slow compared to C

2006-02-12 Thread malv
That's why Microsoft is bringing IronPython on board to have something more decent available with .NET -- http://mail.python.org/mailman/listinfo/python-list

Re: ordered sets operations on lists..

2006-02-12 Thread Bengt Richter
On Sat, 11 Feb 2006 10:24:04 -0800, [EMAIL PROTECTED] (Alex Martelli) wrote: >Raymond Hettinger <[EMAIL PROTECTED]> wrote: > ... >> The intersection step is unnecessary, so the answer can be simplified a >> bit: >> >> >>> filter(set(l2).__contains__, l1) >> [5, 3] >> >>> filter(set(l1).__contai

python and webcam

2006-02-12 Thread dfaber
Hi, I have Logitech webcam and I need to grab images on Fedora Core 4 (not my favorite distro). Are there any python modules available for doing this? Any hints or suggestions would be welcome. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: ordered sets operations on lists..

2006-02-12 Thread Alex Martelli
Bengt Richter <[EMAIL PROTECTED]> wrote: ... > >Personally, I'd always use (depending on guesses regarding lengths of > >lists) [x for x in l1 if x in l2] or the setified equivalent, of course. > > > Perhaps newbies should be advised that > > [x for x in l1 if x in set(l2)] > > is not a (w

Re: Tracking down memory leaks?

2006-02-12 Thread Rene Pijlman
malv: >Is there any way for making Python return memory no longer needed to >the OS? Cases may arise where you indeed need a big memory block >temporarily without being able to split it up into smaller chunks. That's not really necessary. On any decent OS it's just unused address space, that doesn

Small newbie question

2006-02-12 Thread Byte
How would I do this: Write a program that simply outputs a ramdom (in this case) name of (for this example) a Linux distibution. Heres the code ive tryed: from random import uniform from time import sleep x = 2 while x < 5: x = uniform(1, 5) if x >= 1 <= 1.999: print 'SuSE' elif x >=

Re: PEP 353: Using ssize_t as the index type

2006-02-12 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: ... > Discussion > == > > Why not size_t > -- > > An initial attempt to implement this feature tried to use > size_t. It quickly turned out that this cannot work: Python > uses negative indices in m

Re: Single-file executables

2006-02-12 Thread Ravi Teja
As Peter later pointed out, that is a licencing issue rather than a tool issue. After browsing through the PyInstaller documentation, I came across a curious snippet. "On Windows, this provides support for doing in-process COM servers. It is not generalized. However, embedders can follow the same

Downloading Large Files -- Feedback?

2006-02-12 Thread mwt
This code works fine to download files from the web and write them to the local drive: import urllib f = urllib.urlopen("http://www.python.org/blah/blah.zip";) g = f.read() file = open("blah.zip", "wb") file.write(g) file.close() The process is pretty opaque, however. This downloads and writes t

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread Paul Rubin
"mwt" <[EMAIL PROTECTED]> writes: > f = urllib.urlopen("http://www.python.org/blah/blah.zip";) > g = f.read() # ... > So my question is, what is a good way to go about coding this kind of > basic feedback? Also, since my testing has only *worked* with this > code, I'm curious if it will throw a

Ruby/Python Continuations: Turning a block callback into a read()-method ?

2006-02-12 Thread Robert
After failing on a yield/iterator-continuation problem in Python (see below) I tried the Ruby (1.8.2) language first time on that construct: The example tries to convert a block callback interface (Net::FTP.retrbinary) into a read()-like iterator function in order to virtualize the existing FTP cla

Re: Small newbie question

2006-02-12 Thread Tim Parkin
Byte wrote: > How would I do this: Write a program that simply outputs a ramdom (in > this case) name of (for this example) a Linux distibution. Heres the > code ive tryed: > > from random import uniform > from time import sleep > > x = 2 > while x < 5: > x = uniform(1, 5) > if x >= 1 <=

Re: Small newbie question

2006-02-12 Thread Byte
Great stuff, thanks: -- /usr/bin/byte -- http://mail.python.org/mailman/listinfo/python-list

Re: Small newbie question

2006-02-12 Thread Paul Rubin
> while x < 5: > x = uniform(1, 5) > if x >= 1 <= 1.999: print 'SuSE' > ... > It dosnt work: only keep printing SuSE. Please help, Try this: x = 27.6 if x >= 1 <= 1.999: print 'SuSE' It prints 'SuSE' because the test is written incorrectly. You want: if 1 <= x <= 1.999: p

Re: Mental Abuse

2006-02-12 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > My abuser has been using the medical device to harass me the last 4-5 > years. I have no idea what type of a device is being used on me. I > believe the device is only available to licensed pharmacist(s). I am > not very familiar with the intend usage of the device. Can

Re: python and webcam

2006-02-12 Thread Philippe Bouige
In article <[EMAIL PROTECTED]>, dfaber wrote: > I have Logitech webcam and I need to grab images on Fedora Core 4 (not >my favorite distro). Are there any python modules available for doing >this? Any hints or suggestions would be welcome. You can try this : http://videocapture.s

Re: super(...).__init__() vs Base.__init__(self)

2006-02-12 Thread Jan Niklas Fingerle
Tony Nelson <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Jan Niklas Fingerle <[EMAIL PROTECTED]> wrote: > > > ...Super is a good tool to use, when dealing with > > diamond shape inheritance. In any other case I would use the direct > > calls to the base classes. In fact, i've ye

Re: is there a better way?

2006-02-12 Thread drrngrvy
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > > Problem: > > > > You have a list of unknown length, > > This doesn't exist in Python: >len(alist) > > > such as this: list > [X,X,X,O,O,O,O]. You want to extract all and only the > > X's. > > braindead solution - relying on zeros b

[ANN] svnmock 0.3 released

2006-02-12 Thread Collin Winter
Hello all, Version 0.3 of `svnmock`, a package for testing Python applications that use Subversion's Python bindings, has been released. `svnmock` emulates the entire suite of Python bindings, allowing developers to ensure that their application is calling the expected API functions with the expec

Re: python and webcam

2006-02-12 Thread dfaber
It is a Win32 Python Extension. I am looking for something that work on Linux. -- http://mail.python.org/mailman/listinfo/python-list

Re: python and webcam

2006-02-12 Thread Fredrik Lundh
"dfaber" <[EMAIL PROTECTED]> wrote: > It is a Win32 Python Extension. I am looking for something that work > on Linux. here's one: http://antonym.org/libfg (for more alternatives, google for "python webcam linux" or some variation thereof) -- http://mail.python.org/mailman/listinfo/p

Re: super(...).__init__() vs Base.__init__(self)

2006-02-12 Thread Jan Niklas Fingerle
Steven Bethard <[EMAIL PROTECTED]> wrote: > Jan Niklas Fingerle wrote: > > Steven Bethard <[EMAIL PROTECTED]> wrote: > >> Personally, I'd call the lack of the super calls in threading.Thread and > >> Base bugs. > > > > It can't be a bug since it wasn't a bug before super was introduced and > >

Re: Netstat in python. Does it's possible?

2006-02-12 Thread Jorgen Grahn
On Sun, 12 Feb 2006 01:04:14 +0100, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: >> There might still be a problem for people doing things like this: netstat >> might use unstable or non-public APIs to find the things it lists. This is >> fine because it's typically your OS vend

Re: python and webcam

2006-02-12 Thread dfaber
Thank you for your help. I will look around for v4l modules too. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tracking down memory leaks?

2006-02-12 Thread Robert
MKoool wrote: > I have an application with one function called "compute", which given a > filename, goes through that file and performs various statistical > analyses. It uses arrays extensively and loops alot. it prints the > results of it's statistical significance tests to standard out. Sinc

Re: Small newbie question

2006-02-12 Thread Astan Chee
Byte wrote: >How would I do this: Write a program that simply outputs a ramdom (in >this case) name of (for this example) a Linux distibution. Heres the >code ive tryed: > >from random import uniform >from time import sleep > >x = 2 >while x < 5: >x = uniform(1, 5) >if x >= 1 <= 1.999: p

Re: Single-file executables

2006-02-12 Thread Thomas Heller
Martin v. Löwis wrote: > Kevin Walzer wrote: >> The apps I've seen created by py2exe aren't single-file at all, the >> install folder is full of files besides the main program. I'm >> looking for a solution that stuffs all libraries, scripts, and the >> Python runtime into one file. Usually the

Re: python and webcam

2006-02-12 Thread Terry Reedy
"dfaber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > I have Logitech webcam and I need to grab images on Fedora Core 4 (not > my favorite distro). Are there any python modules available for doing > this? Any hints or suggestions would be welcome. If is one of their ball c

  1   2   >