Re: threading and sockets ?

2005-01-15 Thread Jeremy Bowers
On Sun, 16 Jan 2005 05:30:37 +0200, ionel wrote: > how to make a efficient server.. please point me to some good and clear > examples Your question is too broad. There is no such thing as "a server", the server must *do* something and it is generally named for what it does.. Please read http://w

Re: python mode indentation problem

2005-01-15 Thread Tim Peters
[Xah Lee] ... > © who the fuck coded the python mode in emacs? The major contributors are listed at the top of python-mode.el. > fuckhead please peruse: > © http://xahlee.org/UnixResource_dir/writ/responsible_license.html OK, I read it, but have no idea what point you're trying to make here. If

Re: python mode indentation problem

2005-01-15 Thread Steve Holden
Xah Lee wrote: [...] © © who the fuck coded the python mode in emacs? fuckhead please peruse: © http://xahlee.org/UnixResource_dir/writ/responsible_license.html © Pure egotism. Not to mention bad language. regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming

Re: How to del item of a list in loop?

2005-01-15 Thread John Machin
Michael Hoffman wrote: > John Machin wrote: > > > Three significant figures is plenty. Showing just the minimum of the > > results might be better. > > It might be, but how much time do you want to spend on getting your > results for a benchmark that will be run once in the "better" format? > Abo

Re: How to del item of a list in loop?

2005-01-15 Thread Michael Hoffman
John Machin wrote: Three significant figures is plenty. Showing just the minimum of the results might be better. It might be, but how much time do you want to spend on getting your results for a benchmark that will be run once in the "better" format? Next time you can run the benchmark yourself and

nntplib: abstraction of threads

2005-01-15 Thread Rakesh
For a particular application of mine, I need to get the messages from usenet , (and group them by each thread) . My startup python code looks as follows. <--- Startup code to read messages from a newsgroup --> import nntplib, cStringIO, rfc822, sys SRVR = '' # Your news server newsgroup = 'comp.

Re: python mode indentation problem

2005-01-15 Thread Xah Lee
© ok, here's the ordeal. © © for i in range(5): © print i © for i in range(2): © print i, 'tt' © for i in [3]: © print i © for i in [32]: © print i © © # 1 level, 4 space © # 2 level, 1 tab © # 3 level, 1 tab, 4 spaces © # 4 level, 2 tabs. © © w

Re: How to del item of a list in loop?

2005-01-15 Thread John Machin
Nick Coghlan wrote: > I think this is about the best you can do for an in-place version: >for i, x in enumerate(reversed(lst)): > if x == 2: >del lst[-i] I think del lst[-i-1] might be functionally better. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to del item of a list in loop?

2005-01-15 Thread John Machin
Michael Hoffman wrote: > skull wrote: > > but I still have an other thing to worry about coming with this way: does > > performance sucks when the list is big enough? > > It makes a copy operation! > > > > here is a faster and 'ugly' solution: > > > > lst = [1, 2, 3] > > i = 0 > > while i < len(ls

video analysis with python

2005-01-15 Thread Ashot
Hi, I need to write a video analysis tool which extracts statistics from microsocope video. Essentially what I need is to translate the video data into numerical matrices. I have been using Python for the past 1.5 years anytime I could for absolutely everything, because it has every library

Re: there's a socket.sendall(), so why no socket.recvall()?

2005-01-15 Thread Irmen de Jong
Irmen de Jong wrote: Subject says it all; there's a socket.sendall(), so why no socket.recvall()? [...] I may even write a patch for socketmodule.c right now :-D And here it is: the missing socket.recvall(). http://www.python.org/sf/1103213 --Irmen -- http://mail.python.org/mailman/listinfo/python-

Re: What strategy for random accession of records in massive FASTA file?

2005-01-15 Thread Bengt Richter
On Sat, 15 Jan 2005 15:24:56 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: >Bulba! wrote: > >> On 14 Jan 2005 12:30:57 -0800, Paul Rubin >> wrote: >> >> >>>Mmap lets you treat a disk file as an array, so you can randomly >>>access the bytes in the file without having

Re: deleting from tarfile

2005-01-15 Thread Michael Hoffman
Uwe Mayer wrote: is it possible to delete a file from a tar-archive using the tarfile module? The tarlib.py in pyNMS claims to be able to do it. It doesn't use the tarfile module, though. http://cvs.sourceforge.net/viewcvs.py/pynms/pyNMS/lib/tarlib.py?rev=1.1.1.1&view=auto -- Michael Hoffman -- htt

Re: How to del item of a list in loop?

2005-01-15 Thread John Machin
Nick Coghlan wrote: > > I think this is about the best you can do for an in-place version: >for i, x in enumerate(reversed(lst)): > if x == 2: >del lst[-i] Don't think, implement and measure. You may be surprised. Compare these two for example: !def method_del_bkwds(lst, x): !

Re: python mode indentation problem

2005-01-15 Thread M Jared Finder
Xah Lee wrote: does anyone know why the Python mode in emacs uses spaces for first level indentation but one tab for second level? i'm using emacs 21.3.50.1. You probably have tab-width set to 8 spaces, but indentation in python set to 4 spaces. -- MJF -- http://mail.python.org/mailman/listinfo

threading and sockets ?

2005-01-15 Thread ionel
how to make a efficient server.. please point me to some good and clear examples -- ionel. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to del item of a list in loop?

2005-01-15 Thread John Machin
Fredrik Lundh wrote: > > lst = [i for i in lst if i != 2] > > (if you have 2.4, try replacing [] with () and see what happens) The result is a generator with a name ("lst") that's rather misleading in the context. Achieving the same result as the list comprehension, by doing lst = list(i for

Re: java 5 could like python?

2005-01-15 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Bengt Richter <[EMAIL PROTECTED]> wrote: . . . >This triggers a thought: Some are more passive about exploring than others, >and think there's nothing to be seen except what's pointed at. Sad for

The First International Conference on Open Source Systems - OSS 2005 - Main

2005-01-15 Thread Colin J. Williams
I haven't spotted a posting on c.l.p but someone here may be interested. Colin W. http://oss2005.case.unibz.it/ -- http://mail.python.org/mailman/listinfo/python-list

ANN: BOTEC 0.3 -- An astrophysical and orbital mechanics calculator

2005-01-15 Thread Erik Max Francis
Summary BOTEC is a simple astrophysical and orbital mechanics calculator, including a database of all named Solar System objects. Overview BOTEC is intended as a simple but useful calculator to assist with making astrophysical, orbital mechanics, and space navigation calculation

Re: deleting from tarfile

2005-01-15 Thread Mark McEahern
Uwe Mayer wrote: Hi, is it possible to delete a file from a tar-archive using the tarfile module? Thanks Uwe It doesn't appear so. A workaround, of course, is to create a new file with the subset of files from the old file: #!/usr/bin/env python import tarfile import os def removeFile(filena

Re: java 5 could like python?

2005-01-15 Thread Bengt Richter
On Sat, 15 Jan 2005 15:08:05 GMT, [EMAIL PROTECTED] (Cameron Laird) wrote: >In article <[EMAIL PROTECTED]>, >vegetax <[EMAIL PROTECTED]> wrote: > . > . > . >>For example if i remember a function i want ie:get attribute, i dont >>re

Re: [Fwd: Re: Embedding Multiplr Python interpreter in C++]

2005-01-15 Thread Craig Ringer
On Fri, 2005-01-14 at 22:42, Steve Holden wrote: > Take a look at mod_python's code: that allows several independent > interpreters in the same Apache process using Py_NewInterpreter() I've never been entirely clear on whether mod_python does its magic by relying on having one thread per sub-int

Re: What strategy for random accession of records in massive FASTA file?

2005-01-15 Thread Chris Lasher
Roy, thank you for your reply. I have BioPython installed on my box at work and have been browsing through the code in there, some of which I can follow, and most of which will take more time and experience for me to do so. I have considered BioPython and databases, and have chosen to forego those

Re: hash patent by AltNet; Python is prior art?

2005-01-15 Thread Tim Churches
GerritM wrote: ZDnet features an article about the had patent at AltNet http://news.zdnet.com/2100-9588_22-5534087.html . Apparantly this issue plays already for some time, now the p2p companies are threatened, becuase they use hashing to recognize files. I find it incredibly annoying when journali

Re: python to mssql

2005-01-15 Thread Larry Bates
You really need to ask one/several specific questions. Python works with MSSQL. You can go through ODBC, ADO, etc. to work with data in MSSQL database. Hope info helps, Larry Bates Brane wrote: can someone please give me some info regarding subject please advice regards brane -- http://mail.pytho

Re: Com port interrupts again

2005-01-15 Thread engsol
On Fri, 14 Jan 2005 23:25:21 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: >engsol wrote: >> I didn't fully think through my application before posting my >> question. Async com port routines to handle com port interrups >> only work well if one has access to the low level operating >> system. In

Re: Com port interrupts again

2005-01-15 Thread engsol
On Sat, 15 Jan 2005 19:38:19 + (UTC), Chris Liechti <[EMAIL PROTECTED]> wrote: >engsol <[EMAIL PROTECTED]> wrote in >news:[EMAIL PROTECTED]: > >> I didn't fully think through my application before posting my >> question. Async com port routines to handle com port interrups >> only work well

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Scott David Daniels
G.Franzkowiak wrote: Scott David Daniels schrieb: If you really want to do this kind of byte fiddling: http://members.dsl-only.net/~daniels/block.html Then: from block import Block, View b = Block(4) # enough space for one float (more is fine) iv = View('i', b) # getting to it as an

Re: where can i fins some good pywin32 tutorials?

2005-01-15 Thread danjr
"ionel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > need somethin to get started with mfc on python > There is an excellent book found at Amazon Python Programming on Win32 http://tinyurl.com/3qypz -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I get the names of the files in a directory?

2005-01-15 Thread Egor Bolonev
On Sat, 15 Jan 2005 15:16:02 GMT, .removethis. <"(.removethis.)kartic.krishnamurthy"@gmail.com> wrote: Sara Fwd said the following on 1/15/2005 8:10 AM: Can you guys also help me find a module that looks in a directory and print out the names of the files in there? You can use glob: >>> import

Re: What strategy for random accession of records in massive FASTA file?

2005-01-15 Thread Steve Holden
Bulba! wrote: On 14 Jan 2005 12:30:57 -0800, Paul Rubin wrote: Mmap lets you treat a disk file as an array, so you can randomly access the bytes in the file without having to do seek operations Cool! Just say a[234]='x' and you've changed byte 234 of the file to the le

Re: [perl-python] 20050115, for statement

2005-01-15 Thread Jeremy Bowers
On Sat, 15 Jan 2005 10:54:28 +, Michael Hoffman wrote: > Xah Lee wrote: > >> Â a = range(1,51) >> Â for x in a: >> Â if x % 2 == 0: >> Â print x, 'even' > > Now he's mixing tabs and spaces. Hideous. > > Are you doing things wrong on purpose? I think the most exciting thing is the br

Re: Producer/consumer Queue "trick"

2005-01-15 Thread Jeremy Bowers
On Fri, 14 Jan 2005 16:26:02 -0600, Evan Simpson wrote: > WEBoggle needs a new game board every three minutes. Boards take an > unpredictable (much less than 3min, but non-trivial) amount of time to > generate. I gotta ask, why? Looking over your information about "how to play", my only guess

Re: Free NNTP (was Re: how to stop google from messing Python code)

2005-01-15 Thread JanC
Aahz schreef: > You also have access to the free netnews server http://news.cis.dfn.de/ That address is now for DFN internal use only. Their public service moved to . -- JanC "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principle

Re: hash patent by AltNet; Python is prior art?

2005-01-15 Thread Robert Kern
GerritM wrote: ZDnet features an article about the had patent at AltNet http://news.zdnet.com/2100-9588_22-5534087.html . Apparantly this issue plays already for some time, now the p2p companies are threatened, becuase they use hashing to recognize files. As far as I know hasing is a very old techn

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread G.Franzkowiak
Scott David Daniels schrieb: G.Franzkowiak wrote: Scott David Daniels schrieb: franzkowiak wrote: I've read some bytes from a file and just now I can't interpret 4 bytes in this dates like a real value. An extract from my program: def l32(c): return ord(c[0]) + (ord(c[1])<<8) + (ord(c[2])<<16

Re: hash patent by AltNet; Python is prior art?

2005-01-15 Thread Alex Martelli
GerritM <[EMAIL PROTECTED]> wrote: > How can this type of fundamental knowledge be patented? I am afraid this is > again an example of a total failure of the current patent system. As a European citizen, you have a chance to make a difference to software patentability in Europe -- think globally,

LOOK AT THIS!!

2005-01-15 Thread matippc
I swear it works! I just did it, and it worked!!! Instructions: Please read this over completely. It is extremely powerful and will pay you very well. This is not MLM or a ponzi scheme or gifting. All funds come from the company's advertisers so You Pay Nothing! -- not one penny. The company pays

Re: Com port interrupts again

2005-01-15 Thread Chris Liechti
engsol <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > I didn't fully think through my application before posting my > question. Async com port routines to handle com port interrups > only work well if one has access to the low level operating > system. In that case the receive buffer inte

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Terry Reedy
"Scott David Daniels" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > franzkowiak wrote: >> I've read some bytes from a file and just now I can't interpret 4 bytes >> in this dates like a real value. An extract from my program: >> def l32(c): >> return ord(c[0]) + (ord(c[1])<<

Re: Pointer or unique id

2005-01-15 Thread Terry Reedy
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >id(object) -> integer >Return the identity of an object. This is guaranteed to be unique among >simultaneously existing objects. This is part of the language specification. Also, the identity of an object must

hash patent by AltNet; Python is prior art?

2005-01-15 Thread GerritM
ZDnet features an article about the had patent at AltNet http://news.zdnet.com/2100-9588_22-5534087.html . Apparantly this issue plays already for some time, now the p2p companies are threatened, becuase they use hashing to recognize files. As far as I know hasing is a very old technique used to q

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Scott David Daniels
G.Franzkowiak wrote: Scott David Daniels schrieb: franzkowiak wrote: I've read some bytes from a file and just now I can't interpret 4 bytes in this dates like a real value. An extract from my program: def l32(c): return ord(c[0]) + (ord(c[1])<<8) + (ord(c[2])<<16) + (ord(c[3])<<24) ... val

Re: porting C code

2005-01-15 Thread Lucas Raab
Peter Hansen wrote: Lucas Raab wrote: Sorry, the third "byte" is what I meant. Fair enough. Note, however, that as someone pointed out, it's actually the *fourth* of something, and it would not necessarily be a byte. In fact, in your case, it's not: typedef unsigned long int word32 ; void mu

Re: What strategy for random accession of records in massive FASTA file?

2005-01-15 Thread Michael Hoffman
Chris Lasher wrote: I have a rather large (100+ MB) FASTA file from which I need to access records in a random order. I just came across this thread today and I don't understand why you are trying to reinvent the wheel instead of using Biopython which already has a solution to this problem, among o

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Scott David Daniels
franzkowiak wrote: I've read some bytes from a file and just now I can't interpret 4 bytes in this dates like a real value. An extract from my program: def l32(c): return ord(c[0]) + (ord(c[1])<<8) + (ord(c[2])<<16) + (ord(c[3])<<24) ... value = l32(f.read(4)) <--- 3F 8C CC CD should

Re: 20050115, for statement

2005-01-15 Thread BrainDead
Steve Holden wrote: > Michael Hoffman wrote: > > > Xah Lee wrote: > > > >> © a = range(1,51) > >> © for x in a: > >> © if x % 2 == 0: > >> © print x, 'even' > > > > > > Now he's mixing tabs and spaces. Hideous. > > > > Are you doing things wrong on purpose? > > Actually Xah is to be comme

Re: Pointer or unique id

2005-01-15 Thread Bruno Desthuilliers
Nomak a écrit : Hello, does python have an equivalent to Java: int Object.hashCode() ? id(object) -> integer Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (Hint: it's the object's memory address.) hash(obj) -> integer Return a hash valu

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread G.Franzkowiak
Scott David Daniels schrieb: franzkowiak wrote: I've read some bytes from a file and just now I can't interpret 4 bytes in this dates like a real value. An extract from my program: def l32(c): return ord(c[0]) + (ord(c[1])<<8) + (ord(c[2])<<16) + (ord(c[3])<<24) ... value = l32(f.read(4))

Re: python mode indentation problem

2005-01-15 Thread Jorge Luiz Godoy Filho
Xah Lee, SÃbado 15 Janeiro 2005 13:24, wrote: > does anyone know why the Python mode in emacs uses spaces for first > level indentation but one tab for second level? > > i'm using emacs 21.3.50.1. > Xah > [EMAIL PROTECTED] > http://xahlee.org/PageTwo_dir/more.html It doesn't. It uses spaces f

python mode indentation problem

2005-01-15 Thread Xah Lee
does anyone know why the Python mode in emacs uses spaces for first level indentation but one tab for second level? i'm using emacs 21.3.50.1. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] 20050115, for statement

2005-01-15 Thread Steve Holden
Michael Hoffman wrote: Xah Lee wrote: © a = range(1,51) © for x in a: © if x % 2 == 0: © print x, 'even' Now he's mixing tabs and spaces. Hideous. Are you doing things wrong on purpose? Actually Xah is to be commended, since he's united the Perl and Python camps. Both agree he's a nuisan

Re: reusing Tkinter Canvases

2005-01-15 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Sean McIlroy <[EMAIL PROTECTED]> wrote: >I'd like to save one Tkinter Canvas in order to use it on another >Canvas later. The problem is that it gets saved as EPS but it needs to >be GIF to be reuseable. How can I convert that format? .

Re: How can I get the names of the files in a directory?

2005-01-15 Thread .removethis.
Sara Fwd said the following on 1/15/2005 8:10 AM: Can you guys also help me find a module that looks in a directory and print out the names of the files in there? You can use glob: >>> import glob >>> from os.path import isfile >>> print filter(isfile, glob.glob('/tmp/*')) # can use patterns (will

deleting from tarfile

2005-01-15 Thread Uwe Mayer
Hi, is it possible to delete a file from a tar-archive using the tarfile module? Thanks Uwe -- http://mail.python.org/mailman/listinfo/python-list

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Grant Edwards
On 2005-01-15, Scott David Daniels <[EMAIL PROTECTED]> wrote: >> I've read some bytes from a file and just now I can't interpret 4 bytes >> in this dates like a real value. > OK, here's the skinny (I used blocks & views to get the answer): > > import struct > bytes = ''.join(chr(int(txt, 16)) fo

Re: Why 'r' mode anyway?

2005-01-15 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Tim Peters <[EMAIL PROTECTED]> wrote: . . . >reading up the bits in the index and offsets too, etc. IIRC, Unix was >actually quite novel at the time in insisting that all files were just >raw b

Re: How to del item of a list in loop?

2005-01-15 Thread skull
Reinhold Birkenfeld <[EMAIL PROTECTED]> writes: >> Quick solution: >> >> for i in lst[:] >> >> iterates over a copy. > > Addition: In Py2.4, I can't find a problem with > > for i in reversed(lst) > > Any objections? > > Reinhold I just downloaded py2.4, and made a test using reversed. it sure b

Associate objects with Tix.Tree

2005-01-15 Thread Wolfram Kraus
Heyho! I want to associate objects with the nodes of a Tix.Tree. Is this possible, because the following example won't work: --8<-- Cut here - import Tix class C: pass root = Tix.Tk() top = Tix.Frame(root, relief=Tix.RAISED, bd=1) tixtree = Tix.Tree(top) tixtree.pack(e

Re: Python.org, Website of Satan

2005-01-15 Thread Misty
Lucas Raab wrote: Jane wrote: <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] python.org = 194.109.137.226 194 + 109 + 137 + 226 = 666 What is this website with such a demonic name and IP address? What evils are the programmers who use this language up to? Some people have too much ti

Re: Python.org, Website of Satan

2005-01-15 Thread Misty
Jane wrote: "Lucas Raab" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Jane wrote: <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] python.org = 194.109.137.226 194 + 109 + 137 + 226 = 666 What is this website with such a demonic name and IP address? What evils are the p

Re: How to del item of a list in loop?

2005-01-15 Thread Mitja
On Sat, 15 Jan 2005 15:27:08 -0500, skull <[EMAIL PROTECTED]> wrote: lst = [1, 2, 3] for i in lst: print i if i == 2: lst.remove(i) the result is: 1 2 As others have suggested, you can use a copy of the list. Alternatively and depending on what you're trying to accomplish (how comp

interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread franzkowiak
Hello, I've read some bytes from a file and just now I can't interpret 4 bytes in this dates like a real value. An extract from my program def l32(c): return ord(c[0]) + (ord(c[1])<<8) + (ord(c[2])<<16) + (ord(c[3])<<24) ... value = l32(f.read(4)) <--- 3F 8C CC CD should be 1.11 Anyb

Re: Pointer or unique id

2005-01-15 Thread Michael Hoffman
Bruno Desthuilliers wrote: hash(obj) -> integer Return a hash value for the object. Two objects with the same value have the same hash value. The reverse is not necessarily true, but likely. Of course not all Python objects are hashable: >>> hash([]) Traceback (most recent call last): File "",

Pointer or unique id

2005-01-15 Thread Nomak
Hello, does python have an equivalent to Java: int Object.hashCode() ? TIA -- Nomak -- http://mail.python.org/mailman/listinfo/python-list

Dr. Dobb's Python-URL! - weekly Python news and links (Jan 15)

2005-01-15 Thread Cameron Laird
QOTW: "Python: it tastes so good it makes you hungrier." -- EP "I don't consider 'throws Exception' to be sloppy, I consider it to be programmers voting with their feet." -- Roy Smith The Centre for Epidemiology and Research has released a high-quality suite of Python-based "Network-en

Re: What strategy for random accession of records in massive FASTA file?

2005-01-15 Thread Bulba!
On 14 Jan 2005 12:30:57 -0800, Paul Rubin wrote: >Mmap lets you treat a disk file as an array, so you can randomly >access the bytes in the file without having to do seek operations Cool! >Just say a[234]='x' and you've changed byte 234 of the file to the >letter x.

Re: python to mssql

2005-01-15 Thread Brane
On Fri, 14 Jan 2005 15:22:44 -0500, Richards Noah (IFR LIT MET) wrote: > "Robert Brewer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > Brane wrote: >> can someone please give me some info regarding subject >> >>http://sourceforge.net/projects/mysql-python >> >>Ask a broad questio

Re: Producer/consumer Queue "trick"

2005-01-15 Thread Nick Coghlan
Paul Rubin wrote: Evan Simpson <[EMAIL PROTECTED]> writes: wakes up the producer, which has been blocked waiting to add a board to the Queue. It sets about generating the next board, and the consumer doesn't get to run again until the producer blocks again or is preempted. That's weird. Preempti

Re: How to del item of a list in loop?

2005-01-15 Thread Nick Coghlan
Reinhold Birkenfeld wrote: Addition: In Py2.4, I can't find a problem with for i in reversed(lst) Some poking around suggests it's fine - and it avoids copying the list. Don't delete anything earlier in the list than the current element though (which list.remove() will do quite happily when data

Re: Why 'r' mode anyway?

2005-01-15 Thread Nick Coghlan
Skip Montanaro wrote: Tim> "Plays well with others" was a strong motivator for Python's Tim> design, and that often means playing by others' rules. -- My vote for QOTW... Is it too late to slip it into the Zen of Python? It would certainly fit, and the existing koans don't really cover th

Re: java 5 could like python?

2005-01-15 Thread Doug Holton
vegetax wrote: In the other hand, with the recent changes in java 5 i can pythonize java, Have you seen Jython? http://www.jython.org/ It may be the best option for you. It will run just as fast as a regular java program. Also there is groovy: http://groovy.codehaus.org/ -- http://mail.python.or

where can i fins some good pywin32 tutorials?

2005-01-15 Thread ionel
need somethin to get started with mfc on python -- ionel. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to del item of a list in loop?

2005-01-15 Thread Reinhold Birkenfeld
Reinhold Birkenfeld wrote: > skull wrote: >> Hi everybody, it is my first post in this newsgroup. >> I am a newbie for python though I have several years development experience >> in c++. >> recently, I was stumped when I tried to del item of a list when iteration. >> >> here is the wrong way I d

Re: java 5 could like python?

2005-01-15 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, vegetax <[EMAIL PROTECTED]> wrote: . . . >For example if i remember a function i want ie:get attribute, i dont >remember if the module implementer coded it as >getAttribute,GetAttribute,get_attr

Re: Integration with java (Jpype vs. JPE)

2005-01-15 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Jon Perez <[EMAIL PROTECTED]> wrote: >Can someone summarize in a nutshell what is the >difference between JPype and JPE? JPE's the original. It provided more functionality than JPype has achieved so far, I believe (though that could change any day). I think no on

Re: java 5 could like python?

2005-01-15 Thread Roy Smith
vegetax <[EMAIL PROTECTED]> wrote: > -No naming convention. The speech of "it fits in my head" is no longer valid > when i use a lot of functionality,modules,classes in a large proyect. > > For example if i remember a function i want ie:get attribute, i dont > remember if the module implementer co

Re: How to del item of a list in loop?

2005-01-15 Thread Michael Hoffman
skull wrote: but I still have an other thing to worry about coming with this way: does performance sucks when the list is big enough? It makes a copy operation! here is a faster and 'ugly' solution: lst = [1, 2, 3] i = 0 while i < len(lst): if lst[i] == 2: lst.remove(i) else:

Re: Why 'r' mode anyway?

2005-01-15 Thread Skip Montanaro
Tim> "Plays well with others" was a strong motivator for Python's Tim> design, and that often means playing by others' rules. -- My vote for QOTW... Is it too late to slip it into the Zen of Python? Skip -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050115, for statement

2005-01-15 Thread Xah Lee
© # this is an example of for statement © # the % symbol calculates the remainder © # of division. © # the range(m,n) function © # gives a list from m to n-1. © © a = range(1,51) © for x in a: © if x % 2 == 0: © print x, 'even' © © # note that in this example, for goes over a list. © # e

Re: How can I get the names of the files in a directory?

2005-01-15 Thread Jaco Smuts
have a look at the glob module Sara Fwd <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 01/15/2005 03:10 PM To python-list@python.org cc Subject How can I get the names of the files in a directory? Can you guys also help me find a module that looks in a directory and print

Re: Producer/consumer Queue "trick"

2005-01-15 Thread Paul Rubin
Evan Simpson <[EMAIL PROTECTED]> writes: > wakes up the producer, which has been blocked waiting to add a board > to the Queue. It sets about generating the next board, and the > consumer doesn't get to run again until the producer blocks again or > is preempted. That's weird. Preemption should

Re: How can I get the names of the files in a directory?

2005-01-15 Thread Satchidanand Haridas
Hi, try the 'listdir' function in the 'os' module. Also check the 'walk' function. regards, Satchit Satchidanand Haridas (sharidas at zeomega dot com) ZeOmega (www.zeomega.com) Open Minds' Open Solutions #20,Rajalakshmi Plaza, South End Road, Basavanagudi, Bangalore-560 004, India Sara Fwd

How can I get the names of the files in a directory?

2005-01-15 Thread Sara Fwd
Can you guys also help me find a module that looks in a directory and print out the names of the files in there? __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- http://mail.python.or

Re: Producer/consumer Queue "trick"

2005-01-15 Thread Jon Perez
I don't get it. If the consumer and the producer are separate threads, why does the consumer thread block when the producer thread is generating a new board? Or why does it take forever for the producer thread to be pre-empted? Also, I don't understand why the solution works. How does sleeping for

Re: Integration with java (Jpype vs. JPE)

2005-01-15 Thread Jon Perez
Can someone summarize in a nutshell what is the difference between JPype and JPE? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python.org, Website of Satan

2005-01-15 Thread Misty
mr_little wrote: Brian Eable wrote: perl -e '$a="194.109.137.226"; @a = reverse split /\./, $a; for $i (0..3) { $sum += $a[$i]*(256**$i) } print "sum = $sum\n"' 226 + 35072 + 7143424 + 3254779904 = 3261958626 http://3261958626/ Which is NOT 666. Comrade, why perl here? :) Are you afraid python? :)

Re: How to del item of a list in loop?

2005-01-15 Thread Fredrik Lundh
"skull" wrote: > It makes a copy operation! so? in python, shallow copies are cheap. > here is a faster and 'ugly' solution: faster? did you try it, or are you combining a C++ mindset with an urge to do premature optimizations? (hint: it's slower) if you care about performance, you shouldn'

Re: Python.org, Website of Satan

2005-01-15 Thread Misty
Brian Eable wrote: "mr_little" <[EMAIL PROTECTED]> writes: Brian Eable wrote: perl -e '$a="194.109.137.226"; @a = reverse split /\./, $a; for $i (0..3) { $sum += $a[$i]*(256**$i) } print "sum = $sum\n"' 226 + 35072 + 7143424 + 3254779904 = 3261958626 http://3261958626/ Which is NOT 666. Comrade,

Re: How to del item of a list in loop?

2005-01-15 Thread skull
skull <[EMAIL PROTECTED]> writes: Thank you for your replys. lst[:] is did a solution, it makes a copy of list specially for iteration and removes items from the original one. but I still have an other thing to worry about coming with this way: does performance sucks when the list is big enough

Re: How to del item of a list in loop?

2005-01-15 Thread Reinhold Birkenfeld
skull wrote: > Hi everybody, it is my first post in this newsgroup. > I am a newbie for python though I have several years development experience > in c++. > recently, I was stumped when I tried to del item of a list when iteration. > > here is the wrong way I did: > > lst = [1, 2, 3] > for i in

Re: Threading Or Other Suggestions?!?

2005-01-15 Thread Tim Roberts
[EMAIL PROTECTED] wrote: > > I have a wxPython application that does a lot of things. One of them, >in particular, I have doubts on how to implement it. Essentially, this part >of my application calls an external executable (an oil reservoir >simulator). What I would like to do, is to give the

Re: How to del item of a list in loop?

2005-01-15 Thread Fredrik Lundh
"skull" wrote: > Hi everybody, it is my first post in this newsgroup. > I am a newbie for python though I have several years development experience > in c++. > recently, I was stumped when I tried to del item of a list when iteration. > > here is the wrong way I did: > > lst = [1, 2, 3] > for i i

Re: [perl-python] 20050114 if statement

2005-01-15 Thread Reinhold Birkenfeld
Xah Lee wrote: > . # here's an example of if statement in python. > . > . x=-1 > . if x<0: > . print 'neg' > . elif x==0: > . print 'zero' > . elif x==1: > . print 'one' > . else: > . print 'other' > . > . # the elif can be omitted. > . -- > . # here'

How to del item of a list in loop?

2005-01-15 Thread skull
Hi everybody, it is my first post in this newsgroup. I am a newbie for python though I have several years development experience in c++. recently, I was stumped when I tried to del item of a list when iteration. here is the wrong way I did: lst = [1, 2, 3] for i in lst: print i if i ==

New computer

2005-01-15 Thread drinkmyjesus
Hey- Check out this great site that is giving away totally FREE Desktop PCs! I've joined and I think you should as well. It's a completely legitimate offer, and this company has already given away $4 million in FREE stuff! All you have to do is join, complete an online offer, and refer friends

Re: from __future__ import decorators

2005-01-15 Thread Tim Roberts
Jacek Generowicz <[EMAIL PROTECTED]> wrote: > >I have some code, which makes copious use of the @decorator syntax I'm very curious to know what kind of application you are writing in which "copious use of the @decorator syntax" actually solved a problem productively. -- - Tim Roberts, [EMAIL PROT