[pygtk] ANNOUNCE: PyGTK 2.12.1

2008-01-04 Thread Johan Dahlin
I am pleased to announce version 2.12.1 of the Python bindings for GTK; This release includes various bug fixes, plugged memory leaks and a few new features. Most prominently if built against python trunk it will no longer wakeup when it is not necessary since we can avoid the timeout thanks to a

Resetting Signal Mask

2008-01-04 Thread Thomas Guettler
Hi, with mod_wsgi (apache2) a process created with os.system() has a modified signal mask, that SIGPWR gets ignored. A small wrapper (see bottom) resets the signal mask and uses execv to run the programm. Unfortunately python does not support sigprocmask. Is there any other way to reset the

Re: Cursors in a Loop

2008-01-04 Thread Chris
On Jan 4, 5:11 am, Carsten Haese [EMAIL PROTECTED] wrote: On Thu, 2008-01-03 at 17:25 -0800, t_rectenwald wrote: On Jan 3, 7:47 pm, t_rectenwald [EMAIL PROTECTED] wrote: I have a python script that uses the cx_Oracle module. I have a list of values that I iterate through via a for loop

Re: reassign to builtin possible !?

2008-01-04 Thread Bernhard Merkle
On Jan 3, 8:06 pm, Chris Mellon [EMAIL PROTECTED] wrote: In Py3k this will be a syntax error, like assigning to None is now. Possibly also in 2.6. thanks. I feed much better with that :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a HTTP header to a SOAPpy request

2008-01-04 Thread r . grimm
On Jan 3, 5:43 pm, Matias Surdi [EMAIL PROTECTED] wrote: Hi, Could anybody tell me which is the easier way to do a SOAP call to a web service wich requires an http header to be present? I can't figure it out. Thanks a lot Some code I'm using: import SOAPpy s =

Jython: Honourable mention on Charles Nutter's blog.

2008-01-04 Thread Ant
Hi all, The Jython team got an honourable mention on the Headius blog this morning. Apparently they have got Django working with the latest builds of Jython: http://headius.blogspot.com/2008/01/jythons-back-baby.html So congratulations! -- Ant. --

Re: PyObject_CallObject code dump after calling 4 times

2008-01-04 Thread Fredrik Lundh
grbgooglefan wrote: char* plevel = NULL; if(NULL != (plevel = PyString_AsString(pResult))){ ret = 0; strncpy(szEvalResult,plevel,strlen(plevel)); strncpy doesn't check the size of the target buffer, so that's no different from just doing

Re: dictionary/hash and '1' versus 1

2008-01-04 Thread Erik Max Francis
Reedick, Andrew wrote: As a Perl monkey in the process of learning Python, I just stepped on the '1' (string) is not the same as 1 (integer) in regards to keys for dictionaries/hashes landmine. This isn't a landmine; this is a _good_ thing. Python is strongly typed. Is there a good way to

Re: linecache and glob

2008-01-04 Thread Fredrik Lundh
jo3c wrote: i have a 2000 files with header and data i need to get the date information from the header then insert it into my database i am doing it in batch so i use glob.glob('/mydata/*/*/*.txt') to get the date on line 4 in the txt file i use linecache.getline('/mydata/myfile.txt/, 4)

Re: C++ equivalent of comp.lang.python?

2008-01-04 Thread Fredrik Lundh
Russ P. wrote: make sense either. As an example, I was recently trying to get information about writing cross-platform code for dynamic linking, but I couldn't find anywhere appropriate to ask about it. Well, if the good folks at comp.lang.c++ can't even direct you to an appropriate forum

NetSpeed

2008-01-04 Thread Sunil Ghai
Hey can i check the average Downloading speed of available internet connection without downloading any dummy file? :o -- Sunil Ghai -- http://mail.python.org/mailman/listinfo/python-list

Re: Who's to blame?

2008-01-04 Thread Nicola Musatti
Hallo, Mike. First of all, thanks to both you and Rob for your answers. I now see that the wxPython group would have been a better place to post to, all the more so given the tight connection between the wxPython and wxWidgets projects, of which at first I wasn't aware. On Jan 3, 8:19 pm, [EMAIL

import zlib in 2.5 fails

2008-01-04 Thread stuntgoat
import zlib works in Python 2.4 (debian etch AMD64 - default python version for that distro) I built python 2.5 from source; zlib is not importable. I am trying to compile MySQLdb. any clues about how to get zlib able to be imported in 2.5? -sg --

adding class functionality, nested scoping

2008-01-04 Thread jholg
Hi, regarding automatically adding functionality to a class (basically taken from the cookbook recipee) and Python's lexical nested scoping I have a question wrt this code: #- import types # minor variation on cookbook recipee def enhance_method(cls, methodname, replacement):

Why python says unexpected parameter 'mini.py' for my code?

2008-01-04 Thread oyster
The following is my pure-python wxwidgets test. It runs and give a frame, but soon python comes up to say unexpected parameter 'mini.py' and I have to close it. I cannot find the reason. Can somebody give me a hint to let it work well? Thanks http://pyguiviactypes.googlepages.com/mini.py --

Re: problem with global var

2008-01-04 Thread Peter Otten
Bruno Ferreira wrote: I wrote a very simple python program to generate a sorted list of lines from a squid access log file. Now that your immediate problem is solved it's time to look at the heapq module. It solves the problem of finding the N largest items in a list much more efficiently. I

Re: NetSpeed

2008-01-04 Thread Jeroen Ruigrok van der Werven
-On [20080104 10:34], Sunil Ghai ([EMAIL PROTECTED]) wrote: Hey can i check the average Downloading speed of available internet connection without downloading any dummy file? :o For all I know you cannot check anything until you have established some data over a given period of time. So

Re: urllib2 disable proxy

2008-01-04 Thread Richie Hindle
Hi Dimitris, I've been looking for a way to explicitly disable the use of proxies with urllib2, no matter what the environment dictates. Unfortunately I can't find a way [...] Would changing the environment work? Like this: del os.environ['http_proxy'] do_stuff_with_urllib2() --

Re: import zlib in 2.5 fails

2008-01-04 Thread stuntgoat
Modules/main.c:186: warning: function declaration isn't a prototype /home/name/Desktop/webdl/Python-2.5.1/Modules/_ctypes/libffi/src/x86/ ffi64.c:45: warning: function declaration isn't a prototype /home/name/Desktop/webdl/Python-2.5.1/Modules/_ctypes/libffi/src/x86/ ffi64.c:342: warning: function

storing setup.py (for py2exe) in other directory than main script directory

2008-01-04 Thread stefaan
Hello list, I have the following problem after upgrading to python 2.5 and py2exe 0.6.6 It seems that py2exe is using the location of the setup.py file as its search path, instead of the current working folder. (This used to be different with an older version of py2exe) Can I tell py2exe somehow

Re: choosing random dynamic port number

2008-01-04 Thread Giampaolo Rodola'
On 3 Gen, 23:21, Fredrik Lundh [EMAIL PROTECTED] wrote: Emin.shopper Martinian.shopper wrote: Is there a good way to choose/assign random dynamic port numbers in python? I had in mind something like the following, but if multiple programs are generating random port numbers, is there a way

how to connect to a remote machine using python........

2008-01-04 Thread vinoj davis
I am using pexpect with Cgi to ssh into remote machine,Whenever i run a script which does ssh using pexpect from the linux terminal it gives me the correct result, but when i call the script using commands module from the cgi program i am getting the following error.(0, '(256, \'Traceback (most

Re: Strange varargs issue

2008-01-04 Thread Diez B. Roggisch
Mike schrieb: I'm not sure if this is a bug or if I'm just not understanding something correctly. I'm running the following (broken.py) on ActivePython 2.5.1.1, based on Python 2.5.1 (r251:54863 5/1/2007) as python broken.py foo (on Windows, of course): #!/bin/env python import sys

RE: pydepend (checking dependencies like jdepend) ?

2008-01-04 Thread Stefan Schukat
No, py2exe does not display such information but has an algorithm to collect such information. Perhaps this is a starting point for you. Stefan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bernhard Merkle Sent: Friday, January 04, 2008 2:25 PM

Strange varargs issue

2008-01-04 Thread Mike
I'm not sure if this is a bug or if I'm just not understanding something correctly. I'm running the following (broken.py) on ActivePython 2.5.1.1, based on Python 2.5.1 (r251:54863 5/1/2007) as python broken.py foo (on Windows, of course): #!/bin/env python import sys class foobar(object):

Re: ctypes - pointer to array of structs?

2008-01-04 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: (Is this the right place to ask ctypes questions? There's a mailing list but the last post to it seems to have been in November 2006.) You could use the ctypes-users mailing list: https://lists.sourceforge.net/lists/listinfo/ctypes-users It is also available via

Fortran to Python

2008-01-04 Thread Jeroen Ruigrok van der Werven
I got someone who asked me to make changes in an old Fortran program she is using for some calculations. The calculations are pretty standard aside from 2 calls to DLINCG (an IMSL numerical_libraries function to calculate an inverse matrix). What I wonder about, does anybody have a Fortran to

pydepend (checking dependencies like jdepend) ?

2008-01-04 Thread Bernhard Merkle
Hi there, think %Subject says all. I am wondering if there is some tool to check dependencies within python programs. (something like jdepend for python ;-) Of course the dependencies are at runtime (dynamic) and not statically +dynamically (as in Java), but anyway it would be interesting to

Details about pythons set implementation

2008-01-04 Thread Achim Domma
Hi, I'm interested in details about how sets are implemented in python. They seem to be quite fast and I found some remarks who state, that the implementation is highly optimized. I need to implemented sets in C/C++ and need a starting point on how to do it right. Could somebody give me a

Re: Fortran to Python

2008-01-04 Thread Jeroen Ruigrok van der Werven
-On [20080104 14:22], Jeroen Ruigrok van der Werven ([EMAIL PROTECTED]) wrote: What I wonder about, does anybody have a Fortran to Python conversion page somewhere to map some of the basic types to Python equivalents? Just to share my own ideas: Seems COMPLEX*16/complex*16 ~= complex REAL*8

Re: Who's to blame?

2008-01-04 Thread kyosohma
On Jan 4, 3:35 am, Nicola Musatti [EMAIL PROTECTED] wrote: Hallo, Mike. First of all, thanks to both you and Rob for your answers. I now see that the wxPython group would have been a better place to post to, all the more so given the tight connection between the wxPython and wxWidgets

Re: Strange varargs issue

2008-01-04 Thread Fredrik Lundh
Mike wrote: __f.func(a) TypeError: func() takes exactly 1 argument (2 given) How can this possibly be? The caller print statement obviously shows a is singular. __f.func(a) is a method call, and methods always get the object itself as an extra initial argument. to fix this, add self

how to build a dict including a large number of data

2008-01-04 Thread wanzathe
hi everyone i'm a newbie to python :) i have a binary file named test.dat including 960 records. the record format is int a + int b + int c + int d i want to build a dict like this: key=int a,int b values=int c,int d i choose using bsddb and it takes about 140 seconds to build the dict. what

Re: Strange varargs issue

2008-01-04 Thread Chris
On Jan 4, 3:45 pm, Mike [EMAIL PROTECTED] wrote: I'm not sure if this is a bug or if I'm just not understanding something correctly. I'm running the following (broken.py) on ActivePython 2.5.1.1, based on Python 2.5.1 (r251:54863 5/1/2007) as python broken.py foo (on Windows, of course):

RE: pydepend (checking dependencies like jdepend) ?

2008-01-04 Thread Stefan Schukat
Hi, try to look at py2exe. This module scans all dependencies to pack them into one executable. Stefan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bernhard Merkle Sent: Friday, January 04, 2008 1:14 PM To: python-list@python.org Subject:

Re: Who's to blame?

2008-01-04 Thread Nicola Musatti
On Jan 4, 3:12 pm, [EMAIL PROTECTED] wrote: [...] I have sub-classed wx.Dialog to do my own custom modal dialogs as well. You can use sizers and put whatever widgets you want onto it that way. Just make sure that when you create the Yes/No buttons, you give them the wx.ID_YES or wx.ID_NO ids,

Re: Cursors in a Loop

2008-01-04 Thread Carsten Haese
On Fri, 2008-01-04 at 00:03 -0800, Chris wrote: You should bind all variables to save the pool. cursor = connection.cursor() cursor.executemany(insert into as_siebel_hosts_temp values (:whole, :lot, :of, :bind, :variables)

Re: problem with global var

2008-01-04 Thread Bruno Ferreira
Hello all, Amazing :) The program is working properly now, the code is much better and I learned a bit more Python. Thank you all, guys. Bruno. 2008/1/4, Peter Otten [EMAIL PROTECTED]: Bruno Ferreira wrote: I wrote a very simple python program to generate a sorted list of lines from a

Re: how to build a dict including a large number of data

2008-01-04 Thread Fredrik Lundh
wanzathe wrote: i have a binary file named test.dat including 960 records. the record format is int a + int b + int c + int d i want to build a dict like this: key=int a,int b values=int c,int d i choose using bsddb and it takes about 140 seconds to build the dict. you're not building a

Re: Strange varargs issue

2008-01-04 Thread Mike
You know, every once in a while, self really bites me. (I program in Java too much) Thanks for everyone who replied quickly. Mike wrote: [ a bunch of crap because I forgot self, nevermind sorry ] -- http://mail.python.org/mailman/listinfo/python-list

Re: how to build a dict including a large number of data

2008-01-04 Thread Chris
On Jan 4, 3:57 pm, wanzathe [EMAIL PROTECTED] wrote: hi everyone i'm a newbie to python :) i have a binary file named test.dat including 960 records. the record format is int a + int b + int c + int d i want to build a dict like this: key=int a,int b values=int c,int d i choose using

Re: Why python says unexpected parameter 'mini.py' for my code?

2008-01-04 Thread Nick Craig-Wood
oyster [EMAIL PROTECTED] wrote: The following is my pure-python wxwidgets test. It is hardly pure python since it depends on wxWindows and ctypes... It runs and give a frame, but soon python comes up to say unexpected parameter 'mini.py' and I have to close it. I cannot find the reason.

relax

2008-01-04 Thread [EMAIL PROTECTED]
!guys make a brake see something really interesting and then heads again in: http://kavallaris.santorini.googlepages.com/ http://rooms.santorini.googlepages.com/ http://santorini.accommodation.googlepages.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: adding class functionality, nested scoping

2008-01-04 Thread Arnaud Delobelle
On Jan 4, 10:43 am, [EMAIL PROTECTED] wrote: Hi, Hi [...] # Does not work: all enhanced methods only call the last wrapped originial # method. It seems the name 'method' in the surrounding scope of the # def _(...) function definition only refers to the last loop value(?) def

Re: pydepend (checking dependencies like jdepend) ?

2008-01-04 Thread Bernhard Merkle
On Jan 4, 1:57 pm, Stefan Schukat [EMAIL PROTECTED] wrote: Hi, try to look at py2exe. This module scans all dependencies to pack them into one executable. my intention is to _know_ (or display or list or whatever) the dependencies. (see also my original posting). The aim is to control and

pexpect - not printing more than 80 columns

2008-01-04 Thread Maximilian N. Andrews
Dear All, I'm trying to write a script which will check the progress of my MD-simulations on a cluster. So far I've been able to ssh to each node and retrieve the data I was looking for by sending the command top -c -n 1|grep mdrun with pexpect. Unfortunately the string I'm looking for is

Re: python interfaces

2008-01-04 Thread Michele Simionato
On Jan 4, 3:59 pm, hyperboreean [EMAIL PROTECTED] wrote: Hi, Probably it has been asked before, but I'll still ask. Why doesn't python provide interfaces trough its standard library? Or it was ever proposed to be included in the language? Zope's implementation seems pretty flexible and

How Does This Static Variable Work?

2008-01-04 Thread Victor Subervi
Hi; I read this example somewhere, but I don't understand it :-) Can someone please explain how static variables work? Or recommend a good how-to? import random def randomwalk_static(last=[1]): # init the static var(s) rand = random.random() # init a candidate value if last[0] 0.1: #

Scales question

2008-01-04 Thread Eduardo Matus
Hi all... I want to represent a point in 800 X 600 board in a 640 X 480 board..., for example (13, 50) in 640X480 to 800X600 so.. will be like this... Xscale = (13 * 800)/640 Xscale = 16.25 Yscale = (50 * 600)/480 Yscale = 62.5 what happend with the decimals??? I round up or down??? or there

python interfaces

2008-01-04 Thread hyperboreean
Hi, Probably it has been asked before, but I'll still ask. Why doesn't python provide interfaces trough its standard library? Or it was ever proposed to be included in the language? Zope's implementation seems pretty flexible and straightforward. Thanks. --

Re: Details about pythons set implementation

2008-01-04 Thread Hrvoje Niksic
Achim Domma [EMAIL PROTECTED] writes: I'm interested in details about how sets are implemented in python. They seem to be quite fast and I found some remarks who state, that the implementation is highly optimized. I need to implemented sets in C/C++ and need a starting point on how to do it

Re: Details about pythons set implementation

2008-01-04 Thread Neil Cerutti
On Jan 4, 2008 9:54 AM, Achim Domma [EMAIL PROTECTED] wrote: Hi, I'm interested in details about how sets are implemented in python. They seem to be quite fast and I found some remarks who state, that the implementation is highly optimized. I need to implemented sets in C/C++ and need a

Re: Fortran to Python

2008-01-04 Thread Jeroen Ruigrok van der Werven
-On [20080104 15:56], Robin Becker ([EMAIL PROTECTED]) wrote: you probably want to look at numpy an extension that handles lots of matrix things with great ease. I think it now lives at http://scipy.org/ Yeah, I am aware of SciPy/NumPy, but aside from these two calls to do this inverse matrix

Memory Leaks and Heapy

2008-01-04 Thread Yaakov Nemoy
Hi list, Firstly, this is my first post here, so I hope I'm not breaking some unwritten etiquette rule about asking questions involving several different libraries. I'm trying to plug some memory leaks in a TurboGears program. We (the Fedora Project) have a few apps in Turbogears in

Re: pydepend (checking dependencies like jdepend) ?

2008-01-04 Thread Thomas Heller
Stefan Schukat schrieb: No, py2exe does not display such information but has an algorithm to collect such information. Perhaps this is a starting point for you. If py2exe is run with the -x flag, it does display a cross-reference in a browser window. Thomas --

Re: how to build a dict including a large number of data

2008-01-04 Thread wanzathe
On 1月4日, 下午10时17分, Fredrik Lundh [EMAIL PROTECTED] wrote: wanzathe wrote: i have a binary file named test.dat including 960 records. the record format is int a + int b + int c + int d i want to build a dict like this: key=int a,int b values=int c,int d i choose using bsddb and it

Re: Fortran to Python

2008-01-04 Thread Robin Becker
Jeroen Ruigrok van der Werven wrote: -On [20080104 14:22], Jeroen Ruigrok van der Werven ([EMAIL PROTECTED]) wrote: What I wonder about, does anybody have a Fortran to Python conversion page somewhere to map some of the basic types to Python equivalents? Just to share my own ideas: Seems

RE: dictionary/hash and '1' versus 1

2008-01-04 Thread Reedick, Andrew
From: Stephen Hansen [mailto:[EMAIL PROTECTED] Sent: Thursday, January 03, 2008 7:39 PM To: Reedick, Andrew Cc: python-list@python.org Subject: Re: dictionary/hash and '1' versus 1 Well one important thing to learn while learning Python is that while the language is dynamically

Re: Pivot Table/Groupby/Sum question

2008-01-04 Thread patrick . waldo
Petr thanks so much for your input. I'll try to learn SQL, especially if I'll do a lot of database work. I tried to do it John's way as en exercise and I'm happy to say I understand a lot more. Basically I didn't realize I could nest dictionaries like db = {country:{genre:{sub_genre:3}}} and

Re: What's the limit of variables size in pyhton?

2008-01-04 Thread Artur M. Piwko
In the darkest hour on Mon, 31 Dec 2007 20:53:28 -0200, Gabriel Genellina [EMAIL PROTECTED] screamed: Is that mean that i can deal with files with size more than 2GB only if the available memory allow To be more precise, that depends on the OS. On Windows there is a limit of 2GB adressable

Re: Memory Leaks and Heapy

2008-01-04 Thread Jeroen Ruigrok van der Werven
-On [20080104 16:11], Yaakov Nemoy ([EMAIL PROTECTED]) wrote: I'm trying to plug some memory leaks in a TurboGears program. We (the Fedora Project) have a few apps in Turbogears in infrastructure that all seem to be running into the same issues in a variety of configurations. Hopefully when I

Re: how to use bool

2008-01-04 Thread Paul McGuire
On Jan 3, 10:09 am, [EMAIL PROTECTED] wrote: With my philosophical programming hat on the first thing I'd say (as a fairly beginning python programmer) is avoid multiple returns from a function/method if at all possible.  They breed all sorts of problems and errors, in particular if there's

Re: how to use bool

2008-01-04 Thread bukzor
On Jan 3, 7:49 am, [EMAIL PROTECTED] wrote: hi, i have some code where i set a bool type variable and if the value is false i would like to return from the method with an error msg.. being a beginner I wd like some help here class myclass: . def mymethod(self):

Re: Memory Leaks and Heapy

2008-01-04 Thread Yaakov Nemoy
On Jan 4, 2008 11:10 AM, M.-A. Lemburg [EMAIL PROTECTED] wrote: If you're using lots of small objects, you may be running into a problem with the Python memory allocation mechanism, pymalloc. It used to not return memory to the system. In Python 2.5 (IIRC, could be 2.6) this was changed to at

Re: Memory Leaks and Heapy

2008-01-04 Thread M.-A. Lemburg
On 2008-01-04 16:07, Yaakov Nemoy wrote: Hi list, Firstly, this is my first post here, so I hope I'm not breaking some unwritten etiquette rule about asking questions involving several different libraries. I'm trying to plug some memory leaks in a TurboGears program. We (the Fedora

Re: choosing random dynamic port number

2008-01-04 Thread Grant Edwards
On 2008-01-04, Giampaolo Rodola' [EMAIL PROTECTED] wrote:     def GenerateDynamicPortNumber():         return 0 (to get the actual number, use getsockname() on the socket after you've called bind on it) /F By using 0 as port number value you let kernel choose a free unprivileged random

Re: How Does This Static Variable Work?

2008-01-04 Thread Neil Cerutti
On Jan 4, 2008 10:17 AM, Victor Subervi [EMAIL PROTECTED] wrote: Hi; I read this example somewhere, but I don't understand it :-) Can someone please explain how static variables work? Or recommend a good how-to? import random def randomwalk_static(last=[1]): # init the static var(s)

Re: how to use bool

2008-01-04 Thread tinnews
Chris Mellon [EMAIL PROTECTED] wrote: On 03 Jan 2008 16:09:53 GMT, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: hi, i have some code where i set a bool type variable and if the value is false i would like to return from the method with an error msg.. being a beginner I wd like

problem in importing .pyd

2008-01-04 Thread abhishek
hello group , I have build a python c extension. Using python 2.5 , VS.Net 2005 on Win server 2003. But when i am trying to imort this .pyd file into python interperter or my project source code . Code compilation as well as interpreter fails. Resulting in c/c++ runtime error R6034. The

Re: problem in importing .pyd

2008-01-04 Thread Jeroen Ruigrok van der Werven
-On [20080104 16:41], abhishek ([EMAIL PROTECTED]) wrote: What should i do to resolve this problem. Perhaps the hints/tips from http://blogs.msdn.com/nikolad/articles/427101.aspx might help? -- Jeroen Ruigrok van der Werven asmodai(-at-)in-nomine.org / asmodai イェルーン ラウフロック ヴァン デル ウェルヴェン http

Re: How Does This Static Variable Work?

2008-01-04 Thread Victor Subervi
Thanks. I'll study that. Victor On Jan 4, 2008 12:34 PM, Neil Cerutti [EMAIL PROTECTED] wrote: On Jan 4, 2008 10:17 AM, Victor Subervi [EMAIL PROTECTED] wrote: Hi; I read this example somewhere, but I don't understand it :-) Can someone please explain how static variables work? Or

PyGTK, libglade, and signal_autoconnect

2008-01-04 Thread rocco . rossi
I was having a real hard time trying to accomplish something. I couldn't find a way to automatically connect the close button (clicked signal) of a GUI app I was working on, to the gtk.main_quit() function. I had entered this handler directly with the GLADE-3 designer (I DON'T WANT TO USE A

Re: Memory Leaks and Heapy

2008-01-04 Thread Christian Heimes
Jeroen Ruigrok van der Werven wrote: Aside from that (rant), I seriously dislike Python's memory management and even more the fairly arcane ways people have to go about debugging/troubleshooting some 600 MB to 2-3 GB(!) of resident memory use by Python. Personally I consider this the

Re: Memory Leaks and Heapy

2008-01-04 Thread Yaakov Nemoy
On Jan 4, 2008 10:34 AM, Jeroen Ruigrok van der Werven [EMAIL PROTECTED] wrote: As various people pointed out to me: http://wingolog.org/archives/2007/11/27/reducing-the-footprint-of-python-applications It did; it's what lead me to Heapy. Aside from that (rant), I seriously dislike Python's

Re: import zlib in 2.5 fails

2008-01-04 Thread Zentrader
On Jan 4, 2:19 am, stuntgoat [EMAIL PROTECTED] wrote: import zlib works in Python 2.4 (debian etch AMD64 - default python version for that distro) I built python 2.5 from source; zlib is not importable. 2.5 has been available for some time in the Debian repositories. Installing the .deb may

Tabnanny errors when Migrating Python 2.4 code to 2.5

2008-01-04 Thread kyosohma
Hi, When Python 2.5 first came out, I eagerly downloaded it and immediately had issues with getting it to run my 2.4 code. So I just stuck to 2.4. However, I decided this week that I really should try to get 2.5 to work. Does anyone know why code that works perfectly for months in a 2.4

Re: python interfaces

2008-01-04 Thread Sion Arrowsmith
hyperboreean [EMAIL PROTECTED] wrote: Why doesn't python provide interfaces trough its standard library? Because they're pointless. Java interfaces are a hack around the complexities of multiple inheritence. Python does multiple inheritence Just Fine (give or take the subtleties of super()) so

Re: Details about pythons set implementation

2008-01-04 Thread Sion Arrowsmith
Hrvoje Niksic [EMAIL PROTECTED] wrote: BTW if you're using C++, why not simply use std::set? Because ... how to be polite about this? No, I can't. std::set is crap. The implementation is a sorted sequence -- if you're lucky, this is a heap or a C array, and you've got O(log n) performance. But

Re: how to use bool

2008-01-04 Thread bukzor
On Jan 4, 8:51 am, bukzor [EMAIL PROTECTED] wrote: On Jan 3, 7:49 am, [EMAIL PROTECTED] wrote: hi, i have some code where i set a bool type variable and if the value is false i would like to return from the method with an error msg.. being a beginner I wd like some help here class

Re: Memory Leaks and Heapy

2008-01-04 Thread M.-A. Lemburg
On 2008-01-04 17:23, Yaakov Nemoy wrote: On Jan 4, 2008 11:10 AM, M.-A. Lemburg [EMAIL PROTECTED] wrote: If you're using lots of small objects, you may be running into a problem with the Python memory allocation mechanism, pymalloc. It used to not return memory to the system. In Python 2.5

Re: dictionary/hash and '1' versus 1

2008-01-04 Thread Stephen Hansen
A single integer is distinctly different from a sequence of characters in some encoding that may just happen to contain representations of a number so they'll hash differently :) Depends on the context. The machine encoding may be different, but in human terms they should be

Re: Pivot Table/Groupby/Sum question

2008-01-04 Thread petr . jakes . tpc
On Jan 4, 4:55 pm, [EMAIL PROTECTED] wrote: Petr thanks so much for your input. I'll try to learnSQL, especially if I'll do a lot of database work. I tried to do it John's way as en exercise and I'm happy to say I understand a lot more. Basically I didn't realize I could nest dictionaries

Re: Details about pythons set implementation

2008-01-04 Thread bukzor
On Jan 4, 9:08 am, Sion Arrowsmith [EMAIL PROTECTED] wrote: Hrvoje Niksic [EMAIL PROTECTED] wrote: BTW if you're using C++, why not simply use std::set? Because ... how to be polite about this? No, I can't. std::set is crap. The implementation is a sorted sequence -- if you're lucky, this

matplotlib fill command on axes plot problem

2008-01-04 Thread Rominsky
I am trying to use the fill command to draw a box around an object in an image. I can get the box drawn, but there seems to be a side effect. The fill command is adding white lines to the top and sometimes right side of my axes plots. I am using small images, 124x200, and after the fill command

Re: Details about pythons set implementation

2008-01-04 Thread Arnaud Delobelle
On Jan 4, 5:08 pm, Sion Arrowsmith [EMAIL PROTECTED] wrote: [...] But the real killer is that requirement for a std::setT is that T::operator exists. Which means, for instance, that you can't have a set of complex numbers This is really OT but IIRC, std::setT is actually std::set T,

Simple calculation error

2008-01-04 Thread Francois Liot
Dear all, I observed a strange calculation answer, on both python 2.3.4 and 2.4.4 print 753343.44 - 753361.89 -18.450001 print ( (753361.89*100) - (753343.44*100) ) / 100 18.45 Can somebody help me to play correctly with decimal values? Thanks in advance, Francois Liot

Re: Details about pythons set implementation

2008-01-04 Thread Diez B. Roggisch
bukzor schrieb: On Jan 4, 9:08 am, Sion Arrowsmith [EMAIL PROTECTED] wrote: Hrvoje Niksic [EMAIL PROTECTED] wrote: BTW if you're using C++, why not simply use std::set? Because ... how to be polite about this? No, I can't. std::set is crap. The implementation is a sorted sequence -- if

Re: Simple calculation error

2008-01-04 Thread Paul McGuire
On Jan 4, 12:30 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: Francois Liot wrote: I observed a strange calculation answer, on both python 2.3.4 and 2.4.4 print 753343.44 - 753361.89 -18.450001 print ( (753361.89*100) - (753343.44*100) ) / 100 18.45 Can somebody help me to

Re: Simple calculation error

2008-01-04 Thread Fredrik Lundh
Francois Liot wrote: I observed a strange calculation answer, on both python 2.3.4 and 2.4.4 print 753343.44 - 753361.89 -18.450001 print ( (753361.89*100) - (753343.44*100) ) / 100 18.45 Can somebody help me to play correctly with decimal values? A 64-bit binary floating

RE: Simple calculation error

2008-01-04 Thread Francois Liot
No the change of sign is due to a fake copy and past, My question was related to decimal calculation. Thanks, Francois Liot -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul McGuire Sent: Friday, January 04, 2008 1:46 PM To: python-list@python.org

fastest method to choose a random element

2008-01-04 Thread caca
Hello, This is a question for the best method (in terms of performance only) to choose a random element from a list among those that satisfy a certain property. This is the setting: I need to pick from a list a random element that satisfies a given property. All or none of the elements may

MRO Error on Multiple Inheritance?

2008-01-04 Thread Ming
I'm working through Wesley Chun's CPP2e and got this error on 13.11.1, pp 548 where his interpreter snippet shows no problems: ActivePython 2.5.1.1 (ActiveState Software Inc.) b Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [ win32 Type help, copyright, credits or license f class A(object):

Re: Tabnanny errors when Migrating Python 2.4 code to 2.5

2008-01-04 Thread John Machin
On Jan 5, 3:56 am, [EMAIL PROTECTED] wrote: Hi, When Python 2.5 first came out, I eagerly downloaded it and immediately had issues with getting it to run my 2.4 code. So I just stuck to 2.4. However, I decided this week that I really should try to get 2.5 to work. Does anyone know why code

Re: Details about pythons set implementation

2008-01-04 Thread Piet van Oostrum
bukzor [EMAIL PROTECTED] (B) wrote: B Why cant you implement for complex numbers? Maybe I'm being naive, B but isn't this the normal definition? B a + bi c + di iff sqrt(a**2 + b**2) sqrt(c**2, d**2) There doesn't exist a `normal' definition of for the complex numbers. For example you

Re: Question on os.tempnam() vulnerability

2008-01-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Does any one know what kind of security risk these message are suggesting? f = os.tempnam() __main__:1: RuntimeWarning: tempnam is a potential security risk to your program f '/tmp/filed4cJNX' g = os.tmpnam() __main__:1: RuntimeWarning: tmpnam is a potential

Question on os.tempnam() vulnerability

2008-01-04 Thread [EMAIL PROTECTED]
Hello, Does any one know what kind of security risk these message are suggesting? f = os.tempnam() __main__:1: RuntimeWarning: tempnam is a potential security risk to your program f '/tmp/filed4cJNX' g = os.tmpnam() __main__:1: RuntimeWarning: tmpnam is a potential security risk to your

Re: MRO Error on Multiple Inheritance?

2008-01-04 Thread Fredrik Lundh
Ming wrote: TypeError: Error when calling the metaclass bases Cannot create a consistent method resolution order (MRO) for bases A, B (I submitted the problem to the author but I'm not sure I'll ever hear back.) I'm guessing that this kind of diamond inheritance is prohibited by the

Re: fastest method to choose a random element

2008-01-04 Thread Neil Cerutti
On Jan 4, 2008 2:55 PM, [EMAIL PROTECTED] wrote: Hello, This is a question for the best method (in terms of performance only) to choose a random element from a list among those that satisfy a certain property. I would automatically use random.choice(filter(pred_func, a_list)). You just

Re: fastest method to choose a random element

2008-01-04 Thread Neil Cerutti
On Jan 4, 2008 3:47 PM, Neil Cerutti [EMAIL PROTECTED] wrote: On Jan 4, 2008 2:55 PM, [EMAIL PROTECTED] wrote: Hello, This is a question for the best method (in terms of performance only) to choose a random element from a list among those that satisfy a certain property. A simple

Re: MRO Error on Multiple Inheritance?

2008-01-04 Thread Neil Cerutti
On Jan 4, 2008 3:03 PM, Ming [EMAIL PROTECTED] wrote: I'm working through Wesley Chun's CPP2e and got this error on 13.11.1, pp 548 where his interpreter snippet shows no problems: ActivePython 2.5.1.1 (ActiveState Software Inc.) b Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [ win32

  1   2   3   >