Why Python.exe is breaking with memory dump??

2008-01-11 Thread abhishek
Hi group i have created a simple .pyd using which i m able call C function from python code. There are around 6 such functions. 4 of them work great. But when i try to run other two python's exe breaks giving memory dump. Any pros or cons on what led to such a situation.. Is it a problem in my c

HOW TO HANDLE POINTERS FROM NON-LOCAL HEAPS??

2008-01-11 Thread abhishek
Hi group any idea on HOW TO HANDLE POINTERS FROM NON-LOCAL HEAPS?? Thank you -- http://mail.python.org/mailman/listinfo/python-list

how to deliver an application

2008-01-11 Thread jimgardener
hi i have written a program that takes in user input thru a gui and then does some calculations and then displays a result value.I have split the code into 3 parts 1.the gui code--mygui.py containing a class to handle all ui stuff 2.calculations.py (also has one class to do all processing) 3.

Re: Analyzing Python GC output - what is a cell, and what information is available about it.

2008-01-11 Thread Duncan Booth
John Nagle [EMAIL PROTECTED] wrote: I'm printing out each entry in gc.garbage after a garbage collection in DEBUG_LEAK mode, and I'm seeing many entries like cell at 0x00F7C170: function object at 0x00FDD6B0 That's the output of repr. Are cell objects created only from external C

Re: HOW TO HANDLE POINTERS FROM NON-LOCAL HEAPS??

2008-01-11 Thread Duncan Booth
abhishek [EMAIL PROTECTED] wrote: Hi group any idea on HOW TO HANDLE POINTERS FROM NON-LOCAL HEAPS?? Yes, it indicates you haven't read http://catb.org/~esr/faqs/smart-questions.html -- http://mail.python.org/mailman/listinfo/python-list

module finalizer - is there such a beast?

2008-01-11 Thread Helmut Jarausch
Hi, when a module gets imported the statements not contained in function definitions or classes are executed. This can be thought of an initializer for the module. But how can I get control when the module gets unloaded either by Python's gc, Python's exit or by a module reload. Many thanks for

Re: HOW TO HANDLE POINTERS FROM NON-LOCAL HEAPS??

2008-01-11 Thread Gary Herron
abhishek wrote: Hi group any idea on HOW TO HANDLE POINTERS FROM NON-LOCAL HEAPS?? Thank you POINTERS? Heaps? Huh? Ummm, let me think -- those terms *do* sound vaguely familiar -- from sometime in the deep dark primitive past. Perhaps from back in my (shudder) C/C++ days -- ya,

python recursive function

2008-01-11 Thread Tom_chicollegeboy
here is what I have to do: This question involves a game with teddy bears. The game starts when I give you some bears. You then start giving me back some bears, but you must follow these rules (where n is the number of bears that you have): If n is even, then you may give back exactly n/2 bears.

Re: python recursive function

2008-01-11 Thread Bruno Desthuilliers
Tom_chicollegeboy a écrit : (snip) As you see my program must use recursion. It's conceptually easier to express using recursions - but every recursion-based algorithm can be rewritten to use iteration (and vice-versa). I came up with this idea but I am not sure if its right or are there

Re: python recursive function

2008-01-11 Thread Gary Herron
Tom_chicollegeboy wrote: here is what I have to do: This question involves a game with teddy bears. The game starts when I give you some bears. You then start giving me back some bears, but you must follow these rules (where n is the number of bears that you have): This sounds very much

Re: improving performance of python webserver running python scripts in cgi-bin

2008-01-11 Thread Bruno Desthuilliers
Dale a écrit : I am using a simple python webserver (see code below) to serve up python scripts located in my cgi-bin directory. import BaseHTTPServer import CGIHTTPServer class Handler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = ['/cgi-bin'] httpd =

Re: python recursive function

2008-01-11 Thread cokofreedom
On Jan 11, 9:46 am, Gary Herron [EMAIL PROTECTED] wrote: Tom_chicollegeboy wrote: here is what I have to do: This question involves a game with teddy bears. The game starts when I give you some bears. You then start giving me back some bears, but you must follow these rules (where n is

How to POST call and retrieve result page

2008-01-11 Thread suyash jape
Hi all i want to access a web page through python script, fillup the necessary fields, and press submit button (which does POST call) and retrieve the result page and retrieve some values from it. Here is the script i have written till now. import urllib2 # create array of name/value pairs

Re: Python too slow?

2008-01-11 Thread Bruno Desthuilliers
Ross Ridge a écrit : Bruno Desthuilliers [EMAIL PROTECTED] wrote: And the reference implementation of Python (CPython) is not interpreted, it's compiled to byte-code, which is then executed by a VM (just like Java). Ed Jensen a écrit : Wow, this is pretty misleading. Bruno

Re: Python too slow?

2008-01-11 Thread Bruno Desthuilliers
Fredrik Lundh a écrit : A.T.Hofkamp wrote: Now the question you need to answer for yourself, is how much more worth is your own time compared to the gain in CPU time. If you think they are equal (ie the problem as a whole should be solved as fast as possible, thus the sum of

Re: python recursive function

2008-01-11 Thread Chris
On Jan 11, 10:30 am, Tom_chicollegeboy [EMAIL PROTECTED] wrote: here is what I have to do: This question involves a game with teddy bears. The game starts when I give you some bears. You then start giving me back some bears, but you must follow these rules (where n is the number of bears that

Re: python recursive function

2008-01-11 Thread Duncan Booth
Bruno Desthuilliers [EMAIL PROTECTED] wrote: You want: return bears(n - 42) Actually, no he doesn't. He needs to explore all options when the first attempt fails. But I'm not going to write his homework for him. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python too slow?

2008-01-11 Thread Bruno Desthuilliers
George Sakkis a écrit : On Jan 10, 3:37 am, Bruno Desthuilliers wrote: I fail to see how the existence of JIT compilers in some Java VM changes anything to the fact that both Java (by language specification) and CPython use the byte-code/VM scheme. Because these some Java VMs with JIT

Re: python recursive function

2008-01-11 Thread cokofreedom
Stylistically I prefer 'if not n % 5', looks neater. As for your assignment, the hardest task will be creating an effective method of ensuring you recurse through all possibilities. I was chatting to a friend about the 'if not n % 5' and while I am happy to use it saying that when 5 % 5 is

Re: Python too slow?

2008-01-11 Thread Bruno Desthuilliers
Ed Jensen a écrit : Fredrik Lundh [EMAIL PROTECTED] wrote: oh, please. it was perfectly clear for anyone with the slightest clue what Bruno was talking about (especially if they'd read the post he was replying to), so the only question that remains is why you didn't understand it. If

Re: python recursive function

2008-01-11 Thread Bruno Desthuilliers
Gary Herron a écrit : Tom_chicollegeboy wrote: here is what I have to do: This question involves a game with teddy bears. The game starts when I give you some bears. You then start giving me back some bears, but you must follow these rules (where n is the number of bears that you have):

Help with Scons

2008-01-11 Thread anush
Can anybody tell how I could go about running python scripts with scons. -- http://mail.python.org/mailman/listinfo/python-list

help for installing PIL

2008-01-11 Thread Chan Kuang Lim
I'm using Window XP. How to install PIL 1.1.6? The Python i installed, is come with Plone. So, is it ok? Thank you. Regards, Chan Kuang Lim - Looking for last minute shopping deals? Find them fast with Yahoo! Search.--

Re: what does **kw mean?

2008-01-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : I've been reading the following example, and couldn't figure out, what **kw mean. (It's an empty dictionary, but what's the semantics): Keyword varargs. And FWIW, *args is for positional varargs. -- http://mail.python.org/mailman/listinfo/python-list

Re: what does **kw mean?

2008-01-11 Thread Lie
On Jan 11, 4:38 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I've been reading the following example, and couldn't figure out, what **kw mean. (It's an empty dictionary, but what's the semantics): It's a keyword argument. It's some kind of repository for arguments that aren't recognized. If

Re: Why Python.exe is breaking with memory dump??

2008-01-11 Thread Fredrik Lundh
abhishek wrote: Hi group i have created a simple .pyd using which i m able call C function from python code. There are around 6 such functions. 4 of them work great. But when i try to run other two python's exe breaks giving memory dump. Any pros or cons on what led to such a situation..

Re: help for installing PIL

2008-01-11 Thread Fredrik Lundh
Chan Kuang Lim wrote: I'm using Window XP. How to install PIL 1.1.6? The Python i installed, is come with Plone. So, is it ok? Thank you. Just run the appropriate installer for your Python version: http://www.pythonware.com/products/pil as the page says, If the Windows installer cannot

Re: Property with Arguments

2008-01-11 Thread Fredrik Lundh
Lie wrote: Is there a way to create a property with arguments? That's called method in Python, and has it's own syntax. You cannot assign to methods. Or an index value like a list? Make the property that returns a list-like object (hooking __getitem__, __setitem__, etc). /F --

Re: adding methods at runtime

2008-01-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Can I access the class attributes from a method added at runtime? Of course. (My experience says no.) So there's something wrong with your experience !-) I experimented with the following code: class myclass(object): myattr = myattr instance =

Re: python recursive function

2008-01-11 Thread Bruno Desthuilliers
Duncan Booth a écrit : Bruno Desthuilliers [EMAIL PROTECTED] wrote: You want: return bears(n - 42) Actually, no he doesn't. He needs to explore all options when the first attempt fails. Possibly - I didn't bother checking the algorithm correctness, just pointed out an

Re: Embedding python code into text document question.

2008-01-11 Thread Thomas Troeger
Thanks guys, you've helped me very much :) Cheers happy new year! -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2 rate limiting

2008-01-11 Thread Nick Craig-Wood
Dimitrios Apostolou [EMAIL PROTECTED] wrote: I want to limit the download speed when using urllib2. In particular, having several parallel downloads, I want to make sure that their total speed doesn't exceed a maximum value. I can't find a simple way to achieve this. After researching

Re: alternating string replace

2008-01-11 Thread cokofreedom
evenOrOdd = True s1, s2 = hi_cat_bye_dog_foo_bar_red, for i in s1: if i == '_': s2 += ':' if evenOrOdd else ',' evenOrOdd = not evenOrOdd else: s2 += i print s2 Presently I cannot work out how to use .join instead of += ... While I realise this is producing a new

what does **kw mean?

2008-01-11 Thread [EMAIL PROTECTED]
I've been reading the following example, and couldn't figure out, what **kw mean. (It's an empty dictionary, but what's the semantics): def wrap(method): def wrapped(self, *args, **kw): print begin method(self, *args, **kw) print end return wrapped class

encrypting python modules

2008-01-11 Thread Paul Sijben
Hello, this question has come by repeatedly in several guises over the past years but has never been solved in this forum as far as I have been able to Google. However since so many people are asking the question, I hope someone has made a solution and is willing to share it. The problem: I

Re: what does **kw mean?

2008-01-11 Thread Shane Geiger
Does this help? def foobar(first_name,last_name, *args, **kwargs): print first_name print last_name print Tuple:,args print Dict:,kwargs x = has y = demonstrated foobar('Shane','Geiger', x, y, adjective='useful', thing='PYTHON trick known as extended call syntax',

Re: Strange problem: MySQL and python logging using two separate cursors

2008-01-11 Thread Frank Aune
On Wednesday 09 January 2008 18:52:02 Dennis Lee Bieber wrote: On Wed, 9 Jan 2008 10:11:09 +0100, Frank Aune [EMAIL PROTECTED] declaimed the following in comp.lang.python: The only clue I have so far, is that the cursor in task 1 seems to be unable to register any new entries in the log

Re: python recursive function

2008-01-11 Thread HYRY
def bears (n): if n==42: return True if n%5==0: bears(n-42) if n%2==0: bears(n/2) if n%3==0 or n%4==0: one = (n%10) two = ((n%100)/10) if one!=0 and two!=0: bears(n-(one*two)) return False If a game

Re: alternating string replace

2008-01-11 Thread Chris
On Jan 9, 12:34 pm, cesco [EMAIL PROTECTED] wrote: Hi, say I have a string like the following: s1 = 'hi_cat_bye_dog' and I want to replace the even '_' with ':' and the odd '_' with ',' so that I get a new string like the following: s2 = 'hi:cat,bye:dog' Is there a common recipe to

Re: adding methods at runtime

2008-01-11 Thread John Machin
On Jan 11, 10:44 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Thu, 10 Jan 2008 14:55:18 -0800, [EMAIL PROTECTED] wrote: Can I access the class attributes from a method added at runtime? (My experience says no.) I experimented with the following code: [Code snipped] So it

Re: Learning Python via a little word frequency program

2008-01-11 Thread rent
import collections names = freddy fred bill jock kevin andrew kevin kevin jock freq = collections.defaultdict(int) for name in names.split(): freq[name] += 1 keys = freq.keys() keys.sort(key = freq.get, reverse = True) for k in keys: print %-10s: %d % (k, freq[k]) On Jan 9, 6:58 pm,

Re: alternating string replace

2008-01-11 Thread bearophileHUGS
Dennis Lee Bieber: So� in Python, your str[n] := ':' just can not be done! You would have to create a new string containing everything in front of n, the ':', and then everything behind n (skipping n itself, of course). This is a painfully slow operation in Python as it allocates memory for

Property with Arguments

2008-01-11 Thread Lie
Is there a way to create a property with arguments? Or an index value like a list? To be used in the form like: someClass.someProperty['arguments'] = 'some value' or someClass.someProperty('argument1', 'argument2') = 'some value' -- http://mail.python.org/mailman/listinfo/python-list

import gzip error (please help)

2008-01-11 Thread syahreza.octadian
Dear all, Please help, i have error message when i import gzip module. The error like this below: bash-3.00$ python Python 2.5 (r25:51908, Sep 20 2006, 03:46:40) [GCC 3.4.6] on sunos5 Type help, copyright, credits or license for more information. import gzip Traceback (most recent call last):

Re: module finalizer - is there such a beast?

2008-01-11 Thread Thomas Troeger
You can execute cleanup code if the interpreter exits: http://docs.python.org/lib/module-atexit.html This will only cover the `Python's exit' part of your question, not the module reloading stuff. On the other hand, if you load a module you could set a global variable and check for it on

Re: Learning Python via a little word frequency program

2008-01-11 Thread Paul Rubin
rent [EMAIL PROTECTED] writes: keys = freq.keys() keys.sort(key = freq.get, reverse = True) for k in keys: print %-10s: %d % (k, freq[k]) I prefer (untested): def snd((x,y)): return y # I wish this was built-in sorted_freq = sorted(freq.iteritems(), key=snd, reverse=True) for

Re: loading a script from text data

2008-01-11 Thread Fredrik Lundh
Patrick Stinson wrote: Is it possible to load a script from it's text data, and not from a file? I'm writing a scripting engine and need to run the scripts right from the editor. look up the exec statement and, optionally, the compile function in the manual. /F --

Re: reading a specific column from file

2008-01-11 Thread A.T.Hofkamp
On 2008-01-11, cesco [EMAIL PROTECTED] wrote: Hi, I have a file containing four columns of data separated by tabs (\t) and I'd like to read a specific column from it (say the third). Is there any simple way to do this in Python? I've found quite interesting the linecache module but

Re: import gzip error (please help)

2008-01-11 Thread Fredrik Lundh
syahreza.octadian wrote: Please help, i have error message when i import gzip module. The error like this below: bash-3.00$ python Python 2.5 (r25:51908, Sep 20 2006, 03:46:40) [GCC 3.4.6] on sunos5 Type help, copyright, credits or license for more information. import gzip Traceback

Re: python recursive function

2008-01-11 Thread Nick Craig-Wood
HYRY [EMAIL PROTECTED] wrote: def bears (n): if n==42: return True if n%5==0: if bears(n-42): return True if n%2==0: if bears(n/2): return True if n%3==0 or n%4==0: one = (n%10) two =

Re: Converting a bidimensional list in a bidimensional array

2008-01-11 Thread Santiago Romero
- Speed Performance: Do you think that changing from list to Array() would improve speed? I'm going to do lots of tilemap[y][x] checks (I mean, player jumping around the screen, checking if it's falling over a non-zero tile, and so). First of all: if you have enough memory to use a

Re: reading a specific column from file

2008-01-11 Thread Chris
On Jan 11, 2:15 pm, cesco [EMAIL PROTECTED] wrote: Hi, I have a file containing four columns of data separated by tabs (\t) and I'd like to read a specific column from it (say the third). Is there any simple way to do this in Python? I've found quite interesting the linecache module but

reading a specific column from file

2008-01-11 Thread cesco
Hi, I have a file containing four columns of data separated by tabs (\t) and I'd like to read a specific column from it (say the third). Is there any simple way to do this in Python? I've found quite interesting the linecache module but unfortunately that is (to my knowledge) only working on

Re: reading a specific column from file

2008-01-11 Thread Peter Otten
A.T.Hofkamp wrote: On 2008-01-11, cesco [EMAIL PROTECTED] wrote: Hi, I have a file containing four columns of data separated by tabs (\t) and I'd like to read a specific column from it (say the third). Is there any simple way to do this in Python? I've found quite interesting the

Help with Windows build of Yapgvb Python extension

2008-01-11 Thread Lonnie Princehouse
I'm the author of Yapgvb, a Python binding for Graphviz. Yapgvb enjoys modest success, but for some time it has been in dire need of a Python 2.5 build for Windows. I'm posting this message in the hopes of finding someone who is interested in making this build. This is a relatively quick task

Re: Python too slow?

2008-01-11 Thread Hrvoje Niksic
Bruno Desthuilliers [EMAIL PROTECTED] writes: fact 1: CPython compiles source code to byte-code. fact 2: CPython executes this byte-code. fact 3: Sun's JDK compiles source code to byte-code. fact 4: Sun's JDK executes this byte-code. Care to prove me wrong on any of these points ? Don't

Re: Help needed

2008-01-11 Thread Hyuga
On Jan 10, 9:15 pm, tijo [EMAIL PROTECTED] wrote: Hi mate i need o do a python program to connect 2 systems using TCP/IP and UDP. Also i need to check the performance of these two protocols (how many bytes received and how much time took). I havent worked in python earlier and have no idea

Re: python recursive function

2008-01-11 Thread Fidtz
On 11 Jan, 08:30, Tom_chicollegeboy [EMAIL PROTECTED] wrote: here is what I have to do: This question involves a game with teddy bears. The game starts when I give you some bears. You then start giving me back some bears, but you must follow these rules (where n is the number of bears that

Re: Python too slow?

2008-01-11 Thread Ross Ridge
Bruno Desthuilliers [EMAIL PROTECTED] wrote: fact 1: CPython compiles source code to byte-code. fact 2: CPython executes this byte-code. fact 3: Sun's JDK compiles source code to byte-code. fact 4: Sun's JDK executes this byte-code. Care to prove me wrong on any of these points ? Don't bother:

SQLObject 0.10.0b1

2008-01-11 Thread Oleg Broytmann
Hello! I'm pleased to announce the 0.10.0b1, the first beta release of a new SQLObject branch, 0.10. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be

Re: Help with Windows build of Yapgvb Python extension

2008-01-11 Thread Mike
On Jan 11, 8:41 am, Lonnie Princehouse [EMAIL PROTECTED] wrote: I'm the author of Yapgvb, a Python binding for Graphviz. Yapgvb enjoys modest success, but for some time it has been in dire need of a Python 2.5 build for Windows. I'm posting this message in the hopes of finding someone who is

Re: Help with Scons

2008-01-11 Thread Hyuga
On Jan 11, 5:20 am, anush [EMAIL PROTECTED] wrote: Can anybody tell how I could go about running python scripts with scons. Have you tried reading the SCons user guide (http://www.scons.org/doc/ production/HTML/scons-user.html)? It's actually pretty good. I'm not too clear on what you're

Re: Python too slow?

2008-01-11 Thread Chris Mellon
On Jan 11, 2008 9:10 AM, George Sakkis [EMAIL PROTECTED] wrote: On Jan 11, 8:59 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: George Sakkis a écrit : On Jan 11, 4:12 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: George Sakkis a écrit : On Jan 10, 3:37

RE: python recursive function

2008-01-11 Thread Reedick, Andrew
-Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of Tom_chicollegeboy Sent: Friday, January 11, 2008 3:30 AM To: python-list@python.org Subject: python recursive function Now, you are to write a program that, if I give you n bears, returns

MFC app to Python IDLE communication

2008-01-11 Thread konstantin . smolin
Hi all In my MFC application I need to call Python IDLE, pass some terms (or scripts or values - they are simple strings or memo fields) there so that user may modify/evaluate/interpret it and then return the modified terms back to the application. How can I do it the best way (MFC-IDLE)? As for

Re: Python too slow?

2008-01-11 Thread George Sakkis
On Jan 11, 8:59 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: George Sakkis a écrit : On Jan 11, 4:12 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: George Sakkis a écrit : On Jan 10, 3:37 am, Bruno Desthuilliers wrote: I fail to see how the existence of JIT

Re: for loop without variable

2008-01-11 Thread Paul Rubin
Fredrik Lundh [EMAIL PROTECTED] writes: (and if you use sane naming conventions, the risk for collisions is near zero as well). I haven't felt that way, I'm always worried about clobbering something by leaking a variable. Maybe collisions don't really happen much, but it's always seemed

Define installation directory for python

2008-01-11 Thread HajoEhlers
Task: build and install python 2.5.1 on AIX 5.3 to /opt/python2.5 with the subdirectories: ./lib ./bin ./include ./man ./info a.s.o The ./bin ./man are created fine but for ./lib ./include the structure is /opt/python2.5/lib/python2.5 /opt/python2.5/include/python2.5 where i would like

Re: for loop without variable

2008-01-11 Thread Fredrik Lundh
Paul Rubin wrote: it just seems way too obscure though. Python style seems to favor spewing extra variables around. that's because (local) variables have near-zero cost, and zero overhead. use as many as you want, and reuse them as often as you want to. (and if you use sane naming

Re: Python too slow?

2008-01-11 Thread George Sakkis
On Jan 11, 4:12 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: George Sakkis a écrit : On Jan 10, 3:37 am, Bruno Desthuilliers wrote: I fail to see how the existence of JIT compilers in some Java VM changes anything to the fact that both Java (by language specification) and

Re: module finalizer - is there such a beast?

2008-01-11 Thread Peter Otten
Helmut Jarausch wrote: But how can I get control when the module gets unloaded either by Python's gc, Python's exit or by a module reload. Here's a simple approach using the finalizer of an object in the module's globals(): $ cat nirvana.py class Exit(object): def __del__(self):

Re: HOW TO HANDLE POINTERS FROM NON-LOCAL HEAPS??

2008-01-11 Thread James Matthews
Ahh it's good to know that you love pointers like everyone else! On Jan 11, 2008 9:30 AM, Gary Herron [EMAIL PROTECTED] wrote: abhishek wrote: Hi group any idea on HOW TO HANDLE POINTERS FROM NON-LOCAL HEAPS?? Thank you POINTERS? Heaps? Huh? Ummm, let me think -- those terms

Re: Python too slow?

2008-01-11 Thread George Sakkis
On Jan 11, 9:41 am, Hrvoje Niksic [EMAIL PROTECTED] wrote: Bruno Desthuilliers [EMAIL PROTECTED] writes: fact 1: CPython compiles source code to byte-code. fact 2: CPython executes this byte-code. fact 3: Sun's JDK compiles source code to byte-code. fact 4: Sun's JDK executes this

scope question in a switch mixin

2008-01-11 Thread browerg
The code that follows is the result of noodling around with switches as a learning tool. I've played with python for a few years, but I'm self-taught, so . . . Class Switch builds a set of functions. Method switch executes one of them given a value of the switch variable. My question is, why

Using eggs

2008-01-11 Thread oj
Hi all! As is about to become apparent, I really don't know what I'm doing when it comes to using eggs. I'm writing some software that is going to be deployed on a machine as a number of eggs. Which is all well and good. These eggs all end up depending on each other; modules in egg A want to

Re: what does **kw mean?

2008-01-11 Thread [EMAIL PROTECTED]
On Jan 11, 12:24 pm, Lie [EMAIL PROTECTED] wrote: On Jan 11, 4:38 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I've been reading the following example, and couldn't figure out, what **kw mean. (It's an empty dictionary, but what's the semantics): It's a keyword argument. It's some kind

Re: Analyzing Python GC output - what is a cell, and what information is available about it.

2008-01-11 Thread John Nagle
Duncan Booth wrote: John Nagle [EMAIL PROTECTED] wrote: I'm printing out each entry in gc.garbage after a garbage collection in DEBUG_LEAK mode, and I'm seeing many entries like cell at 0x00F7C170: function object at 0x00FDD6B0 That's the output of repr. Are cell objects created only

Re: Help with Windows build of Yapgvb Python extension

2008-01-11 Thread Lonnie Princehouse
On Jan 11, 9:44 am, Mike [EMAIL PROTECTED] wrote: On Jan 11, 8:41 am, Lonnie Princehouse [EMAIL PROTECTED] wrote: I'm the author of Yapgvb, a Python binding for Graphviz. Yapgvb enjoys modest success, but for some time it has been in dire need of a Python 2.5 build for Windows. I'm

Re: Using eggs

2008-01-11 Thread Mike
On Jan 11, 10:33 am, oj [EMAIL PROTECTED] wrote: Hi all! As is about to become apparent, I really don't know what I'm doing when it comes to using eggs. I'm writing some software that is going to be deployed on a machine as a number of eggs. Which is all well and good. These eggs all end

virtualpython / workingenv / virtualenv ... shouldn't this be part of python

2008-01-11 Thread Damjan
There are several attempts to allow python to work with per user (or even per session) 'site-packages' like virtualpython / workingenv / virtualenv. But they all have their own shortcomings and quirks. My question is, shoudn't it be enough to set PYTHONPATH and everything automagically to work

ftplib question (cannot open data connection)

2008-01-11 Thread Laszlo Nagy
Hi All, I'm using a simple program that uploads a file on a remote ftp server. This is an example (not the whole program): def store(self,hostname,username,password,destdir,srcpath): self.ftp = ftplib.FTP(hostname) self.ftp.login(username,password) self.ftp.set_pasv(False)

newbie question regarding int(input(:))

2008-01-11 Thread Craig Ward
Hi experts! I am trying to write a menu script that will execute bash scripts. Everything is fine until the script executes and I want to see if there are any more options to run before quitting. Example: def menu(opt1 = something, opt2 = something else): -- Computers are like air

Re: alternating string replace

2008-01-11 Thread Paddy
On Jan 11, 9:31 am, [EMAIL PROTECTED] wrote: evenOrOdd = True s1, s2 = hi_cat_bye_dog_foo_bar_red, for i in s1: if i == '_': s2 += ':' if evenOrOdd else ',' evenOrOdd = not evenOrOdd else: s2 += i print s2 Presently I cannot work out how to use .join

Re: Python too slow?

2008-01-11 Thread Bruno Desthuilliers
George Sakkis a écrit : On Jan 11, 4:12 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: George Sakkis a écrit : On Jan 10, 3:37 am, Bruno Desthuilliers wrote: I fail to see how the existence of JIT compilers in some Java VM changes anything to the fact that both Java (by language

Re: Python Frontend/GUI for C Program

2008-01-11 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: I have a C program that works very well. However, being C it has no GUI. Input and Output are stdin and stdout... works great from a terminal. Just wondering, has anyone every written a Python GUI for an existing C program? Any notes or documentation available? I

Python Frontend/GUI for C Program

2008-01-11 Thread byte8bits
I have a C program that works very well. However, being C it has no GUI. Input and Output are stdin and stdout... works great from a terminal. Just wondering, has anyone every written a Python GUI for an existing C program? Any notes or documentation available? I have experience using wxPython

Re: reading a specific column from file

2008-01-11 Thread Fredrik Lundh
cesco wrote: I have a file containing four columns of data separated by tabs (\t) and I'd like to read a specific column from it (say the third). Is there any simple way to do this in Python? use the split method and plain old indexing: for line in open(file.txt): columns =

Re: Magic function

2008-01-11 Thread oj
On Jan 11, 4:29 pm, [EMAIL PROTECTED] wrote: Hi all, I'm part of a small team writing a Python package for a scientific computing project. The idea is to make it easy to use for relatively inexperienced programmers. As part of that aim, we're using what we're calling 'magic functions', and

Re: How to POST call and retrieve result page

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 14:44:19 +0530 suyash jape [EMAIL PROTECTED] wrote: Hi all i want to access a web page through python script, fillup the necessary fields, and press submit button (which does POST call) and retrieve the result page and retrieve some values from it. Here is the script i

Fwd: newbie question regarding int(input(:)) - sorry for the spam

2008-01-11 Thread Craig Ward
sorry for the spam Here is the complete message! I am trying to write a menu script that will execute bash scripts. Everything is fine until the script executes and I want to see if there are any more options to run before quitting. Example: = def

Re: Python too slow?

2008-01-11 Thread Ed Jensen
Bruno Desthuilliers [EMAIL PROTECTED] wrote: I don't think you're going to make you some friends here insulting Fredrik. I don't know who Ed Jensen is, but we are quite a lot here to know and respect Mr Lundh for his contributions to Python as both a language and a community. I'll keep in

Re: Detecting OS platform in Python

2008-01-11 Thread Paul Boddie
On 11 Jan, 04:14, Mike Meyer [EMAIL PROTECTED] wrote: On Thu, 10 Jan 2008 18:37:59 -0800 (PST) Devraj [EMAIL PROTECTED] wrote: My Python program needs reliably detect which Operating System its being run on, infact it even needs to know which distribution of say Linux its running on. The

Re: Learning Python via a little word frequency program

2008-01-11 Thread Mike Meyer
On 11 Jan 2008 03:50:53 -0800 Paul Rubin http://phr.cx@NOSPAM.invalid wrote: rent [EMAIL PROTECTED] writes: keys = freq.keys() keys.sort(key = freq.get, reverse = True) for k in keys: print %-10s: %d % (k, freq[k]) I prefer (untested): def snd((x,y)): return y # I wish

RE: reading a specific column from file

2008-01-11 Thread Reedick, Andrew
-Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of Ivan Novick Sent: Friday, January 11, 2008 12:46 PM To: python-list@python.org Subject: Re: reading a specific column from file You say you would like to read a specific column. I wonder

Re: Python too slow?

2008-01-11 Thread Ross Ridge
Bruno Desthuilliers [EMAIL PROTECTED] wrote: And the reference implementation of Python (CPython) is not interpreted, it's compiled to byte-code, which is then executed by a VM (just like Java). Ross Ridge a écrit : Python's byte-code interpreter is not just like Java's virtual machine.

Re: Learning Python via a little word frequency program

2008-01-11 Thread Hrvoje Niksic
Mike Meyer [EMAIL PROTECTED] writes: On 11 Jan 2008 03:50:53 -0800 Paul Rubin http://phr.cx@NOSPAM.invalid wrote: rent [EMAIL PROTECTED] writes: keys = freq.keys() keys.sort(key = freq.get, reverse = True) for k in keys: print %-10s: %d % (k, freq[k]) I prefer (untested):

Re: Magic function

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 08:29:18 -0800 (PST) [EMAIL PROTECTED] wrote: Hi all, I'm part of a small team writing a Python package for a scientific computing project. The idea is to make it easy to use for relatively inexperienced programmers. As part of that aim, we're using what we're calling

[no subject]

2008-01-11 Thread m . s . mould
Hi, I have what I suspect to be a fairly simple problem while using python Numeric. I am attempting to count the number of times that an element 'b' occurs in numeric array 'a'. I tried unsuccessfully to find a more efficient function to do this for me such as that offered when using a list, but

Re: Analyzing Python GC output - what is a cell, and what information is available about it.

2008-01-11 Thread Francesco Guerrieri
On Jan 11, 2008 6:20 PM, John Nagle [EMAIL PROTECTED] wrote: Tried: print item.dir() got: 'cell' object has no attribute 'dir' I don't know nothing about cell objects... but why don't you try dir(item) instead? Francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Frontend/GUI for C Program

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 08:12:48 -0800 (PST) [EMAIL PROTECTED] wrote: I have a C program that works very well. However, being C it has no GUI. What does C have to do with it not having a GUI? I've written more C programs with a GUI than Python ones - and the C experience was generally better. Of

  1   2   3   4   >