Are weak refs slower than strong refs?

2007-02-24 Thread John Nagle
Are weak refs slower than strong refs? I've been considering making the "parent" links in BeautifulSoup into weak refs, so the trees will release immediately when they're no longer needed. In general, all links back towards the root of a tree should be weak refs; this breaks the loops that giv

Re: convert python scripts to exe file

2007-02-24 Thread Gabriel Genellina
En Sun, 25 Feb 2007 00:29:53 -0300, Eric CHAO <[EMAIL PROTECTED]> escribió: > I know py2exe can make an exe file. But python runtime dll is still > there. How can I combine the dll file into the exe, just make one > file? May I ask why? If you want to distribute your app on a single file, there

Re: How to build Hierarchies of dict's? (Prototypes in Python?)

2007-02-24 Thread Gabriel Genellina
En Sat, 24 Feb 2007 21:29:13 -0300, Charles D Hixson <[EMAIL PROTECTED]> escribió: > Sorry, the "script" hasn't been written. But Python apparently *won't* > (automatically) do what I want, which is create a class whose > sub-classes automatically have unique class variables of a determined > f

Re: Endianness conversion

2007-02-24 Thread Gabriel Genellina
En Sat, 24 Feb 2007 14:27:12 -0300, Toby <[EMAIL PROTECTED]> escribió: > I ended up writing my own byteswapper in Pyrex: You can use the byteswap method of arrays: >>> import array >>> a = array.array('H', 'ABcd56') >>> a.tostring() 'ABcd56' >>> a.byteswap() >>> a.tostring() 'BAdc65' -- Gabrie

convert python scripts to exe file

2007-02-24 Thread Eric CHAO
I know py2exe can make an exe file. But python runtime dll is still there. How can I combine the dll file into the exe, just make one file? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Referencing Items in a List of Tuples

2007-02-24 Thread Paul Rubin
"Rune Strand" <[EMAIL PROTECTED]> writes: > if you want numeric adressing, try: > for i in range(len(mainlist)): >if mainlist[i][0] == 'eco' etc. Preferable: for i,m in enumerate(mainlist): if m[0] == 'eco' etc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Referencing Items in a List of Tuples

2007-02-24 Thread John Machin
On Feb 25, 1:01 pm, [EMAIL PROTECTED] wrote: > While working with lists of tuples is probably very common, none of my > five Python books or a Google search tell me how to refer to specific items > in each tuple. I find references to sorting a list of tuples, but not > extracting tuples based on

Re: Referencing Items in a List of Tuples

2007-02-24 Thread Rune Strand
On Feb 25, 3:01 am, [EMAIL PROTECTED] wrote: > In my case, I have a list of 9 tuples. Each tuple has 30 items. The first > two items are 3-character strings, the remaining 28 itmes are floats. > > I want to create a new list from each tuple. But, I want the selection of > tuples, and their assi

Referencing Items in a List of Tuples

2007-02-24 Thread rshepard
While working with lists of tuples is probably very common, none of my five Python books or a Google search tell me how to refer to specific items in each tuple. I find references to sorting a list of tuples, but not extracting tuples based on their content. In my case, I have a list of 9 tupl

ANN: xlrd 0.6.1a4 is now available

2007-02-24 Thread John Machin
An alpha release (a4) of version 0.6.1 of xlrd is now available from http://www.lexicon.net/sjmachin/xlrd.htm and from the Cheeseshop (http://cheeseshop.python.org/pypi/xlrd). What is xlrd? It's a small (download approx 0.1 Mb) pure-Python library for extracting information from Microsoft Excel (

Re: What happened to SPE?

2007-02-24 Thread SPE - Stani's Python Editor
On Feb 3, 2:18 am, Jaroslaw Zabiello <[EMAIL PROTECTED]> wrote: > Dnia 11 Jan 2007 17:02:49 +0100, Neil Cerutti napisa³(a): > > >SPElost its web host, and last I heard is looking for a new > > home. For now you can get it here: > > > http://sourceforge.net/projects/spe/ > > That is old addres. Nev

Re: How to build Hierarchies of dict's? (Prototypes in Python?)

2007-02-24 Thread Charles D Hixson
Toby wrote: > Charles D Hixson wrote: > >> What I basically want is a kind of class that has both class and >> instance level dict variables, such that descendant classes >> automatically create their own class and instance level dict variables. >> The idea is that if a member of this hierar

Re: newbie needs help building Python 2.5 for Fedora Core 6

2007-02-24 Thread bobmon
WOW. I'm gobsmacked... On Feb 24, 6:13 pm, Tony Nelson <[EMAIL PROTECTED]> wrote: > > Try it from the python command line. This is what happens when I try it Okay, that was interesting... Apparently there's a subtlety of /etc/hosts that affects this! Originally it had this line: 127.0.0.1

Re: Newbie question: Install Tkinter with Python2.5

2007-02-24 Thread bobmon
> how can I install Tkinter with Python2.5? I can install Python2.5 > (tarball) in the usual way but there is no Tkinter? What's wrong? I'm trying to build Python 2.5 under FC6, and had similar problems (plus others). I had to do "yum install" 'tcl-devel.i386' and 'tk- devel.i386' to get the tc

Re: newbie needs help building Python 2.5 for Fedora Core 6

2007-02-24 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "bobmon" <[EMAIL PROTECTED]> wrote: > Hello, and please be gentle... > > I'm trying to build Python 2.5 on my Fedora Core 6 installation. I > think I've resolved most of my problems, but "make test" reports an > error for test_socket.py, shown below. > > I suppo

newbie needs help building Python 2.5 for Fedora Core 6

2007-02-24 Thread bobmon
Hello, and please be gentle... I'm trying to build Python 2.5 on my Fedora Core 6 installation. I think I've resolved most of my problems, but "make test" reports an error for test_socket.py, shown below. I suppose my FC6 installation is missing something, but I have no idea what. Any ideas, di

Re: Endianness conversion

2007-02-24 Thread Toby
Daniel Harding wrote: > Try the using the array module. array objects provide a byteswap > method which reverses endianness. Thanks! Toby -- http://mail.python.org/mailman/listinfo/python-list

[ANN] argparse 0.6 - Command-line parsing library

2007-02-24 Thread Steven Bethard
Announcing argparse 0.6 --- argparse home: http://argparse.python-hosting.com/ argparse single module download: http://argparse.python-hosting.com/file/trunk/argparse.py?format=raw argparse bundled downloads at PyPI: http://www.python.org/pypi/argparse/ About this rele

Re: Help Required for Choosing Programming Language

2007-02-24 Thread Thomas Bartkus
On Mon, 19 Feb 2007 08:03:43 -0800, Andy Dingley wrote: > GUI-based" is fairly unimportant as it's just how you build your > programs, not what they do afterwards Most user apps. require 95% of coding effort to provide a usable user interface and 5% effort on the algorithmic meat. The "afterwar

Jobs: Lisp and Python programmers (Los Angeles)

2007-02-24 Thread Tech HR
http://www.smartcharter.com/jobs.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Endianness conversion

2007-02-24 Thread Daniel Harding
On Feb 24, 9:39 am, Toby <[EMAIL PROTECTED]> wrote: > As part of a program I'm writing, I need to save to disk big amounts of > data (hundreds of MB, in 8kB chunks) swapping every couple of bytes. > > I obviously cannot do it in a Python loop. > > Is there a function I could use in the standard lib

Re: Endianness conversion

2007-02-24 Thread Toby
Dan Sommers wrote: > You could try the struct module. If your input comes in fixed sized > chunks, just call struct.unpack and struct.pack once per chunk. Thanks, but it was a bit awkward to use for big chunks. I ended up writing my own byteswapper in Pyrex: def swapbytes(data): "Swap every

Re: Any Idea about thread safe issue with python

2007-02-24 Thread mralokkp
On Feb 16, 11:37 pm, Bjoern Schliessmann wrote: > mralokkp wrote: > > I need help guys. I have a code running properly and execute again > > after a certain time. > > In Simple words [incomplete and useless code line] is not solving > > my purpose. Would any body like to help. > > Please be so kin

Re: Recreating a char array from a pointer

2007-02-24 Thread buffinator
Oh, nice Im running 2.4 but im gonna download it and give it a try then Thanks! Thomas Heller wrote: > buffinator schrieb: >> I have an application that has to send a string as a pointer to memory, >> and then another one that has to retriece it and fetch the string. >> Converting the string to

Re: How to build Hierarchies of dict's? (Prototypes in Python?)

2007-02-24 Thread Toby
Charles D Hixson wrote: > What I basically want is a kind of class that has both class and > instance level dict variables, such that descendant classes > automatically create their own class and instance level dict variables. > The idea is that if a member of this hierarchy looks up something

Re: Recreating a char array from a pointer

2007-02-24 Thread Thomas Heller
buffinator schrieb: > I have an application that has to send a string as a pointer to memory, > and then another one that has to retriece it and fetch the string. > Converting the string to an array and sending the pointer was easy > > import array > a=array.array("c","mytextgoeshere") > my_poin

*** CANADIAN ANTI-TERROR LAW HAS BEEN STRUCK DOWN BY ITS HONORABLE SUPREME COURT UNANIMOUSLY ***

2007-02-24 Thread stj911
Canada anti-terror law is struck down >From the Associated Press February 24, 2007 OTTAWA - Canada's Supreme Court on Friday unanimously declared it unconstitutional to detain foreign terrorism suspects indefinitely while the courts review their deportation orders. Five Arab Muslim men have been

Recreating a char array from a pointer

2007-02-24 Thread buffinator
I have an application that has to send a string as a pointer to memory, and then another one that has to retriece it and fetch the string. Converting the string to an array and sending the pointer was easy import array a=array.array("c","mytextgoeshere") my_pointer = a.buffer_info()[0] But the

Re: Endianness conversion

2007-02-24 Thread Dan Sommers
On Sat, 24 Feb 2007 15:39:53 +, Toby wrote: > As part of a program I'm writing, I need to save to disk big amounts of > data (hundreds of MB, in 8kB chunks) swapping every couple of bytes. > > I obviously cannot do it in a Python loop. > > Is there a function I could use in the standard li

INSTALL ODDITIES

2007-02-24 Thread Schnizalfritz
When I built python 2.5 for linux I did the normal: configure make make install Everything went fine til the "make install" part. It dies with no error. just says "install failed" after this: Compiling /usr/local/lib/python2.5/zipfile.py That part built fine but the next part failed. So what I

Endianness conversion

2007-02-24 Thread Toby
As part of a program I'm writing, I need to save to disk big amounts of data (hundreds of MB, in 8kB chunks) swapping every couple of bytes. I obviously cannot do it in a Python loop. Is there a function I could use in the standard library, or do I have to write my own C extension? Toby -- h

arf

2007-02-24 Thread John Doe
arf -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance project for the SigEx Foundry

2007-02-24 Thread pablo
On Feb 22, 8:40 pm, [EMAIL PROTECTED] wrote: > On Feb 21, 1:15 pm, [EMAIL PROTECTED] wrote: > > > have been testing performances of different scripting languages > > fordatabase access, text processing and client application data > > transfer. So far, I am getting better performance from PHP, but I

Re: Newbie in the deep - some PyGTK questions

2007-02-24 Thread Dieter Verfaillie
Hi, On Fri, 2007-02-23 at 11:36 +, nmp wrote: > First "problem": when I insert the glade file in my application the way > some tutorials have shown me: > > self.wTree = gtk.glade.XML("autostart.glade", "mainWindow") > > ... Python is consistently giving me this warning: > > /home/xx

Re: CSV(???)

2007-02-24 Thread David C.Ullrich
On 23 Feb 2007 07:31:35 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: >On Feb 23, 10:11 pm, David C. Ullrich <[EMAIL PROTECTED]> >wrote: >> Is there a csvlib out there somewhere? > >I can make available the following which should be capable of running >on 1.5.2 -- unless they've suffered bitrot

Re: Finding non ascii characters in a set of files

2007-02-24 Thread Toby A Inkster
bg_ie wrote: > What I'd like to do is scan a directory and list all the > files in it that contain a non ascii character. Not quite sure what your intention is. If you're planning a one-time scan of a directory for non-ASCII characters in files, so that you can manually fix those files up, then t

Re: Newbie question: Install Tkinter with Python2.5

2007-02-24 Thread TK
Hi, > I see that Tcl/Tk detection has been moved in the Python source > distribution (since the "good old days" when I last had to deal with > this kind of thing) from the configure machinery to the setup.py > program. However, a few things worth checking include (1) whether you > not only have th

Re: CSV(???)

2007-02-24 Thread David C.Ullrich
On 23 Feb 2007 19:13:10 +0100, Neil Cerutti <[EMAIL PROTECTED]> wrote: >On 2007-02-23, David C Ullrich <[EMAIL PROTECTED]> wrote: >> Is there a csvlib out there somewhere? >> >> And/or does anyone see any problems with >> the code below? >> >> [...] >> >> (Um: Believe it or not I'm _still_ using

Re: CSV(???)

2007-02-24 Thread David C.Ullrich
On 23 Feb 2007 11:51:57 GMT, nmp <[EMAIL PROTECTED]> wrote: >Op Fri, 23 Feb 2007 11:45:54 +, schreef nmp: > >> Op Fri, 23 Feb 2007 05:11:26 -0600, schreef David C. Ullrich: >> >>> Is there a csvlib out there somewhere? >> >> Hey, cool! I am just beginning with Python but I may already be abl

Re: CSV(???)

2007-02-24 Thread David C.Ullrich
On Fri, 23 Feb 2007 11:43:24 + (UTC), Philipp Pagel <[EMAIL PROTECTED]> wrote: >David C. Ullrich <[EMAIL PROTECTED]> wrote: >> Is there a csvlib out there somewhere? > >How about csv in the standard library? > >> (Um: Believe it or not I'm _still_ using >> python 1.5.7. > >I have no idea if cs

Re: Convert to binary and convert back to strings

2007-02-24 Thread Paul Rubin
"Hendrik van Rooyen" <[EMAIL PROTECTED]> writes: > > s += chr(reduce(operator.xor, ar)) > Yikes! - someday soon I am going to read the docs on what reduce does... Reduce just intersperses an operator over a sequence. For example, reduce(operator.add, (a,b,c,d,e)) is a+b+c+d+e. > Won't this

Re: Convert to binary and convert back to strings

2007-02-24 Thread Hendrik van Rooyen
"Paul Rubin" wrote: > "Hendrik van Rooyen" <[EMAIL PROTECTED]> writes: > > s = 'some string that needs a bcc appended' > > ar = array.array('B',s) > > bcc = 0 > > for x in ar[:]: > > bcc ^= x > > ar.append(bcc) > > s=ar.tostring() > > Untested: > > import operator

Re: Rational numbers

2007-02-24 Thread Toby A Inkster
aleaxit wrote: > If anybody who has easy access to Microsoft's MSVC++.NET (and is willing > to try building GMP 4.2 with/for it), or a PPC Mac with XCode installed > (possibly with MacOSX 10.3...) I'm writing this message on a MacOS 10.3.9 box with Xcode 1.5 (gcc 3.3) installed. If you tell me ho

Re: failed to install PIL in fedora core 6

2007-02-24 Thread Michele Petrazzo
Frank Potter wrote: > I use "python setup.py install" to install PIL in fedora with python > 2.4, But I got these errors: <-cut some errors-> > error: Python.h: No such file or directory In file included from > libImaging/Imaging.h:14, from _imaging.c:78: So you don't have the python-dev packag