Re: Pythonic use of CSV module to skip headers?

2004-12-02 Thread Steve Holden
Ramon Felciano wrote: Hi -- I'm using the csv module to parse a tab-delimited file and wondered whether there was a more elegant way to skip an possible header line. I'm doing line = 0 reader = csv.reader(file(filename)) for row in reader: if (ignoreFirstLine

Re: pre-PEP generic objects

2004-12-02 Thread Istvan Albert
Steven Bethard wrote: I promised I'd put together a PEP for a 'generic object' data type for Python 2.5 that allows one to replace __getitem__ style access with dotted-attribute style access (without declaring another class). Any comments would be appreciated! IMHO this too easy to accomplish r

Re: Pythonic list to bitflag mapping

2004-12-02 Thread Ramon Felciano
> Or can be used directly as an integer index to get a character > > >>> ['01'[x in a] for x in xrange(10)] > ['0', '0', '0', '1', '1', '0', '1', '0', '0', '0'] > Very cool -- this does the trick nicely and seems quite extensible, now that I get the basic idiom. Belated thanks for the quick re

Python2.4: building '_socket' extension fails with `INET_ADDRSTRLEN' undeclared

2004-12-02 Thread Michael Ströder
HI! I'm trying to build Python2.4 on a rather old Debian machine. I only have a shell account there. That's why I'm very limited in my actions. Building _socket fails (see below) although I tried to use configure --disable-ipv6 Any clue? Ciao, Michael. -- snip

Re: Pythonic use of CSV module to skip headers?

2004-12-02 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Ramon Felciano wrote: > Hi -- > > I'm using the csv module to parse a tab-delimited file and wondered > whether there was a more elegant way to skip an possible header line. > I'm doing > > line = 0 > reader = csv.reader(file(filename)) > for row in read

Re: PySQLite Table indexing inside a functions

2004-12-02 Thread Kevin
Hello Again, It may be cleaner if I reduce the code: def PARSE2DB(data,tablename): i = 0 cadu = GETdb().cursor() FacetNum = len(data [1]) while i < FacetNum: cadu.execute(""" insert into table = 'tablename' ( V1_x, V1_y, V1_z) values(%f, %f, %f)

Re: efficient intersection of lists with rounding

2004-12-02 Thread Diez B. Roggisch
> A couple of other bits of info. > - a and b are ordered smallest to largest (could bisect module be used?) > - in the future I will want to round the second number of closest 0.25 > rather than whole number. > > Would the sets module be more efficient? > > I'm using python 2.3. I'd go for some

PySQLLite Speed

2004-12-02 Thread Kevin
Hello All, I wondering if anyone has encountered the same issue with using PySQL. This is my first time using this DB so this preformance may be typical. I'm reading an ASCII file through PyParse that contains about 1.3Meg of Float data. 8000 Triangles (3 Vertexes and 1 Normal). This file read

Re: Galois field

2004-12-02 Thread Terry Reedy
"Roie Kerstein" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am looking for a python package that deals with galois fields. > > Does anybody know where can I find it? Googling python 'galois fields' gives over 500 hits, the most recent being your identical question on catalog-

Versioning Libraries

2004-12-02 Thread Randall Smith
As Python changes and old code still needs to work properly, I wonder if there is a standard way to note which version of the Python interpreter code is intended to work with. I know that an executable may begin with #!/usr/bin/python2.3 or something similar, but what about libraries and such?

Re: How is Python designed?

2004-12-02 Thread Terry Reedy
"Limin Fu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there any technical description on internet of how > python is designed? Or can somebody give a short > description about this? I'm just curious. One answer is that Python is currently designed by a group of voluntary d

Writing apps without using relative imports

2004-12-02 Thread Randall Smith
I've noticed the push by Guido and others to use absolute imports instead of relative imports. I've always enjoyed the ease of relative imports, but am starting to understand that "explicit is better than implicitly" as the Python philosophy goes. I'm trying to develop a strategy for writing

File locking and logging

2004-12-02 Thread Kamus of Kadizhar
Thanks to Robert Brewer, I got enough insight into logging to make it work Now I have another issue: file locking. Sorry if this is a very basic question, but I can't find a handy reference anywhere that mentions this. When a logger opens a log file for append, is it automatically locked so

Re: efficient intersection of lists with rounding

2004-12-02 Thread Steven Bethard
Gordon Williams wrote: I have to lists that I need to find the common numbers (2nd rounded to nearest integral) and I am wondering if there is a more efficient way of doing it. a= [(123,1.3),(123,2.4),(123,7.8),(123,10.2)] b= [(123, 0.9), (123, 1.9), (123, 8.0)] [ (i,round(j)) for i,j in a for l,m

Re: How is Python designed?

2004-12-02 Thread Roy Smith
As far as I can tell, the process works like this: Guido has an idea for something he wants to do and announces it. Everybody beats him up about it. He goes ahead and does it anyway. It's a strange process, but it seems to work. -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP generic objects

2004-12-02 Thread Steven Bethard
Istvan Albert wrote: Steven Bethard wrote: I promised I'd put together a PEP for a 'generic object' data type for Python 2.5 that allows one to replace __getitem__ style access with dotted-attribute style access (without declaring another class). Any comments would be appreciated! IMHO this to

RE: How is Python designed?

2004-12-02 Thread Delaney, Timothy C (Timothy)
Roy Smith wrote: > As far as I can tell, the process works like this: > > Guido has an idea for something he wants to do and announces it. > > Everybody beats him up about it. > > He goes ahead and does it anyway. > > It's a strange process, but it seems to work. It's not quite that straightf

Re: disk based dictionaries

2004-12-02 Thread Larry Bates
You may also want to take a look at ZODB (Zope database). It handles the pickling, storage and retrieval of all Python objects (including dictionaries) very well. And yes you can use ZODB without using Zope proper. http://www.zope.org/Products/StandaloneZODB http://zope.org/Members/adytumsolutions

Re: PySQLLite Speed

2004-12-02 Thread Robert Kern
Kevin wrote: Hello All, I wondering if anyone has encountered the same issue with using PySQL. This is my first time using this DB so this preformance may be typical. I'm reading an ASCII file through PyParse that contains about 1.3Meg of Float data. 8000 Triangles (3 Vertexes and 1 Normal). Th

installing 2.4

2004-12-02 Thread Jive
I just now installed 2.4. I naively copied my site-package from 2.3. The first program I tried to run, which uses the gnuplot package, got this error, complaining about module Numeric: ImportError: Module use of python23.dll conflicts with this version of Python. Grumble: Why does Numeric refer

Re: pre-PEP generic objects

2004-12-02 Thread Paul Rubin
Steven Bethard <[EMAIL PROTECTED]> writes: > > IMHO this too easy to accomplish right now to warrant > > an "official" implementation: > > class Bunch: > > pass > > b = Bunch() > > b.one, b.two, b.three = 1,2,3 > > works just fine, depending on the problem I might add a few special > > operator

Re: Python 2.4 and Tkinter

2004-12-02 Thread Jean Brouwers
It is hard to tell what is wrong, exactly. Two suggestions: If this is a 32-bit build, why is there a "-L/usr/X11R6/lib64" and *before* the regular "-L/usr/X11R6/lib"? Try to rerun just that line "gcc -pthread _tkinter.so" but without the "-L/usr/X11R6/lib64" option. If that still fails

Re: installing 2.4

2004-12-02 Thread Jive
Gack! I can't run it under 2.3 anymore either! Dag nab it! "Jive" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I just now installed 2.4. I naively copied my site-package from 2.3. The > first program I tried to run, which uses the gnuplot package, got this > error, complainin

Re: installing 2.4

2004-12-02 Thread Jive
Correction. It still runs under 2.3. However, Pythonwin now doesn't work right under 2.3. The interactive window grabs the cursor and won't let it go. I have to go to the task manager to kill Pythonwin. "Jive" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I just now installed

Re: Versioning Libraries

2004-12-02 Thread Peter Hansen
Randall Smith wrote: As Python changes and old code still needs to work properly, I wonder if there is a standard way to note which version of the Python interpreter code is intended to work with. I know that an executable may begin with #!/usr/bin/python2.3 or something similar, but what about

Re: installing 2.4

2004-12-02 Thread Peter Hansen
Jive wrote: I just now installed 2.4. I naively copied my site-package from 2.3. The first program I tried to run, which uses the gnuplot package, got this error, complaining about module Numeric: ImportError: Module use of python23.dll conflicts with this version of Python. Grumble: Why does Num

Re: installing 2.4

2004-12-02 Thread Jive
Well ain't that a kick in the pants? Version 2.3 is broke now, so I'm kind of stuck. I haven't found a 2.4 version of Numeric. Do you know where to find one? "Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jive wrote: > > I just now installed 2.4. I naively copied

Re: PyQt on a Server

2004-12-02 Thread Bob Parnes
On 29 Nov 2004 11:07:48 -0500, Jerry Sievers <[EMAIL PROTECTED]> wrote: > Bob Parnes <[EMAIL PROTECTED]> writes: > >> I have an application importing qt on a linux server and am missing >> something in trying to run it from a workstation via nfs. The >> workstation has the server /usr directory

Re: installing 2.4

2004-12-02 Thread Jeff Shannon
Jive wrote: Well ain't that a kick in the pants? Version 2.3 is broke now, so I'm kind of stuck. I haven't found a 2.4 version of Numeric. Do you know where to find one? Since 2.4 has only been released for a few days, it'll probably be a short while yet before all the various third-party pac

Re: non blocking read()

2004-12-02 Thread Greg Ewing
Donn Cave wrote: Yes, this looks right to me, but I think we're talking about os.read(), not fileobject.read(). Indeed, you shouldn't be mixing select() with buffered io, or all kinds of bad things can happen. Everything I said applies to OS-level reads and writes, not stdio-level ones. -- Greg Ewi

Re: A way to wait Python event

2004-12-02 Thread Josiah Carlson
[EMAIL PROTECTED] (Chang LI) wrote: > > I tried to launch "python.exe test.py" in another program. After the > launch the console was showed and exited on Windows. I want the > console stay there. Is there a Python statement to wait an event loop > like Tcl's "after forever"? I'm a fan of... _

Re: PySQLLite Speed

2004-12-02 Thread Roger Binns
"Kevin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Then when it starts to > write the Database, the PC Util drops to 1-2% and it > takes forever. I'm not PC related preformance > barriers that I'm aware of. Your hard disk. See the synchronous information in the pragmas: http

Re: installing 2.4

2004-12-02 Thread Jive
I am befuddled. I've re-installed everything I can think of, but I still get this behavior: I start up Pythonwin. Sometimes the interactive window shows the copyright stuff; sometimes it doesn't; In any case, I can't close it by clicking on the X button at the top right of the main window. The

Re: installing 2.4

2004-12-02 Thread Jive
It's only getting worse. I went to Add/remove programs and removed 2.4. Now Python 2.4 numarray and Python 2.4 pywin extensions are still listed as installed, but I cannot remove them. -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators ?

2004-12-02 Thread Josiah Carlson
Jacek Generowicz <[EMAIL PROTECTED]> wrote: > > BJörn Lindqvist <[EMAIL PROTECTED]> writes: > > > I think the essence of decorators is that it makes it possible to do > > in Python what you in other languages do with method qualifiers. > > I find it fascinating that the addition of a bit of syn

Re: decorators ?

2004-12-02 Thread Jp Calderone
On Thu, 02 Dec 2004 18:30:15 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > [snip] > > Technically, everything can be performed in assembly. The point of > syntactic sugar (or ammonia) is to make things less painful. While > everything was possible before, adding the decorators /after/ def

Re: efficient intersection of lists with rounding

2004-12-02 Thread Michael Hoffman
Steven Bethard wrote: Well, in Python 2.3, I believe sets are implemented in Python while they're implemented in C in Python 2.4. I think the Python 2.3 Sets implementation is likely to be quicker than whatever list-manipulation answer you come up with instead. But there's only one way to find o

Re: Versioning Libraries

2004-12-02 Thread Bryan
Peter Hansen wrote: Randall Smith wrote: As Python changes and old code still needs to work properly, I wonder if there is a standard way to note which version of the Python interpreter code is intended to work with. I know that an executable may begin with #!/usr/bin/python2.3 or something sim

pythonwin broke

2004-12-02 Thread Jive
I've un-installed Python 2.4, re-installed Python 2.3 and PythonWin for 2.3, but it's still broke. When I start PythonWin, sometimes it looks like it is going to be okay. But as soon as I open a .py file, the interactive window grabs the focus and will not let go. I am stumped. Is there somethi

Re: installing 2.4

2004-12-02 Thread Jeff Shannon
Jive wrote: As for checking the "application path", I don't know what that means. Go to a command prompt, and type 'echo %path%'. You'll see a list of all the directories that Windows looks in to find an executable -- i.e., if you type 'python', Windows will work through this list of directo

Re: inheritance problem with 2 cooperative methods

2004-12-02 Thread Greg Ewing
Dan Perl wrote: So far, so good! But let's assume that I want to change the __init__ methods so that they take a configuration as an argument so the objects are created and configured in one step, like this: alpha = A(config) One way would be to make the setConfig call only in the root class, an

Re: installing 2.4

2004-12-02 Thread David Bolen
"Jive" <[EMAIL PROTECTED]> writes: > It's only getting worse. I went to Add/remove programs and removed 2.4. > Now Python 2.4 numarray and Python 2.4 pywin extensions are still listed as > installed, but I cannot remove them. You mentioned in your first post about "copying your site package" ...

Re: installing 2.4

2004-12-02 Thread Jive
"David Bolen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Jive" <[EMAIL PROTECTED]> writes: > > > It's only getting worse. I went to Add/remove programs and removed 2.4. > > Now Python 2.4 numarray and Python 2.4 pywin extensions are still listed as > > installed, but I cannot

Re: installing 2.4

2004-12-02 Thread Jive
"Jeff Shannon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jive wrote: > > >As for checking the "application path", I don't know what that means. > > > > > > Go to a command prompt, and type 'echo %path%'. You'll see a list of > all the directories that Windows looks in to find

Re: efficient intersection of lists with rounding

2004-12-02 Thread Greg Ewing
Gordon Williams wrote: a= [(123,1.3),(123,2.4),(123,7.8),(123,10.2)] b= [(123, 0.9), (123, 1.9), (123, 8.0)] [ (i,round(j)) for i,j in a for l,m in b if (i,round(j)) == (l,round(m))] d = {} for (l, m) in b: d[l, round(m)] = 1 result = [] for (i, j) in a: t = (i, round(j)) if t in d: resul

Re: why python is slower than java?

2004-12-02 Thread developerchina
hehe Asun Friere wrote: > [EMAIL PROTECTED] (Alex Martelli) wrote in message news:<[EMAIL PROTECTED]>... > > > [A]sking for tolerance and patience > > against _rude_ newbies which barge in with shrill, mostly unjustified, > > repetitious complaints, is, I think, a rather far-fetched request. > > Th

Re: inheritance problem with 2 cooperative methods

2004-12-02 Thread Dan Perl
Thank you very much, Greg, that does the job! Somehow I couldn't see it and I needed someone to point out to me. Dan "Greg Ewing" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dan Perl wrote: >> So far, so good! But let's assume that I want to change the __init__ >> methods s

Re: efficient intersection of lists with rounding

2004-12-02 Thread Adam DePrince
On Thu, 2004-12-02 at 22:16, Greg Ewing wrote: > Gordon Williams wrote: > a= [(123,1.3),(123,2.4),(123,7.8),(123,10.2)] > b= [(123, 0.9), (123, 1.9), (123, 8.0)] > [ (i,round(j)) for i,j in a for l,m in b if (i,round(j)) == > > (l,round(m))] > > d = {} > for (l, m) in b: >d[l, roun

Re: Python Design Patterns

2004-12-02 Thread Dave Cook
"Tony Ha" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Hello Dave, > > Thanks for pointing me to the Cookbook website. > > On 2004-11-29, Tony Ha <[EMAIL PROTECTED]> wrote: > > > > > I wonder, can any Python guru out there translate the Java examples in For anyone tran

PySQLLite Speed

2004-12-02 Thread Kevin
Hello All, I wanted to thank Roger Binn for his email. He had the answer to my issue with writing speed. It's actual made an incredible change in the preformace. I didn't have to go all the way to implementing the synchronous mode(for my app). Previously, I was insert one record at a time. Th

Re: PySQLLite Speed

2004-12-02 Thread Adam DePrince
On Thu, 2004-12-02 at 23:39, Kevin wrote: > Hello All, > > I wanted to thank Roger Binn for his email. He had > the answer to my issue with writing speed. It's > actual made an incredible change in the preformace. I > didn't have to go all the way to implementing the > synchronous mode(for my a

Re: Python 2.4 and Tkinter

2004-12-02 Thread Jeffrey Barish
Jean Brouwers wrote: > > It is hard to tell what is wrong, exactly. Two suggestions: > > If this is a 32-bit build, why is there a "-L/usr/X11R6/lib64" and > *before* the regular "-L/usr/X11R6/lib"? Try to rerun just that line > "gcc -pthread _tkinter.so" but without the "-L/usr/X11R6/l

Re: installing wxPython on Linux and Windows

2004-12-02 Thread Simon John
I have used the Fedora2 RPM's of wxPython 2.5.3.1 successfully on SUSE 9.1 Pro, 9.2 Pro and SLES 9 (and Fedora 3 for that matter) so you don't need to get a specific RPM for SUSE. I even built wxPython 2.5.3.1 with Python 2.4 on Fedora 2 today, it was not that hard - just followed http://wxpython.

Re: efficient intersection of lists with rounding

2004-12-02 Thread Steven Bethard
Michael Hoffman wrote: Steven Bethard wrote: Well, in Python 2.3, I believe sets are implemented in Python while they're implemented in C in Python 2.4. I think the Python 2.3 Sets implementation is likely to be quicker than whatever list-manipulation answer you come up with instead. But there's

how to list files with extension .txt in windows?

2004-12-02 Thread ed
hi I ahve a simple question and is new to python. I have a folder in windows that contains some .txt files. the fucntion that i want to do is whenever there is new directory created (say 249, thos enew directorys are always in numbers in 3 digit), i want to grap that 249 and the previous created on

Re: how to list files with extension .txt in windows?

2004-12-02 Thread Aaron Bingham
ed wrote: I have used batch script to do it but it has a lot of issues with access denied... errors I pretty much given up using batch to do this. If you do not have permission to access the files, switching to a different language will not help you. You need to determine the cause of your ac

<    1   2