Can local function access local variables in main program?

2007-11-03 Thread Sullivan WxPyQtKinter
I am confused by the following program: def f(): print x x=12345 f() result is: 12345 however: def f(): print x x=0 x=12345 f() result is: Traceback (most recent call last): File ...\test.py, line 5, in ? f() File ...\test.py, line 2, in f print x UnboundLocalError:

Re: count increment...

2007-11-03 Thread Hendrik van Rooyen
Beema shafreen wrote: 8 --- file my script: #!/usr/bin/env python fh = open('complete_span','r') line = fh.readline().split('#') old_probe = line[0].strip() old_value = line[1].strip() print old_probe, old_value count = 1 Better to start the count off as

Re: Can local function access local variables in main program?

2007-11-03 Thread Steven D'Aprano
On Sat, 03 Nov 2007 07:18:17 +, Sullivan WxPyQtKinter wrote: def f(): print x x=0 x=12345 f() result is: Traceback (most recent call last): File ...\test.py, line 5, in ? f() File ...\test.py, line 2, in f print x UnboundLocalError: local variable 'x'

Re: Can local function access local variables in main program?

2007-11-03 Thread Stargaming
On Sat, 03 Nov 2007 07:18:17 +, Sullivan WxPyQtKinter wrote: I am confused by the following program: def f(): print x x=12345 f() result is: 12345 If python can't discover x in your current scope and you do not bind to it there, it will automatically access that global name

Re: python newbie

2007-11-03 Thread Steven D'Aprano
On Sat, 03 Nov 2007 08:36:24 +0200, Hendrik van Rooyen wrote: Bruno Desthuilliers wrote: functions are *not* methods of their module. Now I am confused - if I write: result = foo.bar(param) Then if foo is a class, we probably all agree that bar is a method of foo. There are funny

Re: how to pass a function name and its arguments inside the arguments of other function?

2007-11-03 Thread Stargaming
On Sat, 03 Nov 2007 02:21:30 +, jmborr wrote: I need something like this: 1: superfoo( non-keyword-args, keyword-args, methodname, *kargs, *kwargs): 2: non-keyword-args and keyword-args are arguments that 3: apply to superfoo, while *kargs and **kwargs are arguments

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Kay Schluehr
On Nov 3, 6:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 2, 5:47 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: Pyparsing is no recursive descent parser. It doesn't go

Re: IDLE

2007-11-03 Thread Tal Einat
On Nov 3, 12:44 am, Russ P. [EMAIL PROTECTED] wrote: I've been programming in python for a few years using XEmacs on Solaris and Linux. I've been thinking about trying IDLE for a long time, but either it wasn't available on my system or I procrastinated. I finally have it available, and I gave

Re: IDLE

2007-11-03 Thread rustompmody
Just curious: What makes you wish to move from emacs to idle? Admission: I used to be a dyed-in-the-wool emacs guy but Ive been having trouble with it lately. eg Yesterday when editing a largish file (I think it was setup.py) it kept going to sleep and when I killed emacs it said LALR

Re: (MAC) CoreGraphics module???

2007-11-03 Thread David C. Ullrich
On Fri, 02 Nov 2007 14:09:25 -0500, Robert Kern [EMAIL PROTECTED] wrote: David C. Ullrich wrote: [...] So CoreGraphics is a builtin in Apple-Python, explaining why I didn't find the relevant CoreGraphics.py anywhere on the hard drive, eh? Okay, which version of OS X do you have? In 10.3

Re: (MAC) CoreGraphics module???

2007-11-03 Thread David C. Ullrich
On Fri, 2 Nov 2007 13:14:16 +0100, Tommy Nordgren [EMAIL PROTECTED] wrote: On 2 nov 2007, at 02.10, David C. Ullrich wrote: [Why doesn't CoreGraphics work?] -- http://mail.python.org/mailman/listinfo/python-list There are Python wrappers for the Cocoa API. These can be used with

Re: Can local function access local variables in main program?

2007-11-03 Thread Bjoern Schliessmann
Sullivan WxPyQtKinter wrote: UnboundLocalError: local variable 'x' referenced before assignment For your reference: http://groups.google.de/groups?q=group:comp.lang.python+UnboundLocalError Regards, Björn -- BOFH excuse #12: dry joints on cable plug --

Re: simple question on dictionary usage

2007-11-03 Thread r . grimm
On Oct 27, 6:42 am, Karthik Gurusamy [EMAIL PROTECTED] wrote: On Oct 26, 9:29 pm, Frank Stutzman [EMAIL PROTECTED] wrote: My apologies in advance, I'm new to python Say, I have a dictionary that looks like this: record={'BAT': '14.4', 'USD': '24', 'DIF': '45', 'OAT': '16',

Re: __file__ vs __FILE__

2007-11-03 Thread Bjoern Schliessmann
Jeff McNeil wrote: I've used the 'os.path.realpath(os.path.pardir)' construct in a couple of scripts myself. In Windows? Using Linux, this gives me ... I use os.path.dirname(os.path.abspath(__file__)) That ought to work within the interactive interpreter. Why do you also enter that code in

Re: python newbie

2007-11-03 Thread Bjoern Schliessmann
Hendrik van Rooyen wrote: So what's the difference ? Why can't bar be called a method of foo, or is it merely a convention that classes have methods and modules have functions? In depends on which terminology you use. As Steven told, Python methods are special functions. In contrast, the

Re: py2exe (or other exe builder) on Vista system for Vista/XP install targets.

2007-11-03 Thread Bjoern Schliessmann
Michael wrote: Björn, what library files end up being in your dist directory for that project? Would you mind posting a copy of the output of dir? Okay, sorry for the delay. Here the output of py2exe is, for directory contents see below. | The following modules appear to be missing |

Re: python newbie

2007-11-03 Thread Duncan Booth
Steven D'Aprano [EMAIL PROTECTED] wrote: Then if foo is a class, we probably all agree that bar is a method of foo. There are funny edge cases (e.g. bar might be an attribute with a __call__ method) but in general, yes, bar would be a method of foo. But that 'funny edge case' is exactly

Re: python newbie

2007-11-03 Thread Paul Rubin
Duncan Booth [EMAIL PROTECTED] writes: modules are not special in any way, except that you cannot subclass them. Oops, sorry I got that wrong. Modules are not special in any way, they can have methods as well as functions: I've felt for a long time that you should be able to define __call__

Re: __file__ vs __FILE__

2007-11-03 Thread Giampaolo Rodola'
On 3 Nov, 04:21, klenwell [EMAIL PROTECTED] wrote: I apologize in advance for coming at this from this angle but... In PHP you have the __FILE__ constant which gives you the value of the absolute path of the file you're in (as opposed to the main script file.) With the function dirname, this

Poor python and/or Zope performance on Sparc

2007-11-03 Thread joa2212
Hello everybody, I'm posting this message because I'm quiet frustrated. We just bought a software from a small software vendor. In the beginning he hosted our application on a small server at his office. I think it was a Fujitsu-Siemens x86 running debian Linux. The performance of the DSL-Line

Python launcher not working on Mac after Leopard upgrade?

2007-11-03 Thread André
I just installed Leopard on my Mac. I already was using Python 2.5. I can run a Python script from a terminal window by typing python script.py as one would expect ... but not using the Python launcher either directly or indirectly (by double clicking on a Python icon). Has anyone else observed

Python IDE

2007-11-03 Thread Simon Pickles
Hi, I have recently moved from Windows XP to Ubuntu Gutsy. I need a Python IDE and debugger, but have yet to find one as good as Pyscripter for Windows. Can anyone recommend anything? What are you all using? Coming from a Visual Studio background, editing text files and using the terminal to

Re: python newbie

2007-11-03 Thread Gabriel Genellina
En Sat, 03 Nov 2007 09:55:38 -0300, Paul Rubin http://phr.cx@NOSPAM.invalid escribió: Duncan Booth [EMAIL PROTECTED] writes: modules are not special in any way, except that you cannot subclass them. Oops, sorry I got that wrong. Modules are not special in any way, they can have

Re: __file__ vs __FILE__

2007-11-03 Thread Gabriel Genellina
En Sat, 03 Nov 2007 10:07:10 -0300, Giampaolo Rodola' [EMAIL PROTECTED] escribió: On 3 Nov, 04:21, klenwell [EMAIL PROTECTED] wrote: In PHP you have the __FILE__ constant which gives you the value of the absolute path of the file you're in (as opposed to the main script file.) This is

Re: difference between IDLE and command line

2007-11-03 Thread Tal Einat
Jim Hendricks wrote: I have been editing my code in UltraEdit then testing in IDLE by choosing open, then F5. I didn't see an easy way to refresh in IDLE, so each edit I've been closing the file (not IDLE itself), then opening again. Since IDLE does not keep track of what directory I last

Re: Python IDE

2007-11-03 Thread M.O.
Simon Pickles wrote: Hi, I have recently moved from Windows XP to Ubuntu Gutsy. I need a Python IDE and debugger, but have yet to find one as good as Pyscripter for Windows. Can anyone recommend anything? What are you all using? I use Eric. Works very well for me.

Re: __file__ vs __FILE__

2007-11-03 Thread Jeff McNeil
I'm using Mac OS X, and it get: Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type help, copyright, credits or license for more information. import os os.getcwd() '/Users/jeff' os.path.realpath(os.path.pardir) '/Users' The __file__

Re: Python IDE

2007-11-03 Thread BartlebyScrivener
On Nov 3, 9:11 am, Simon Pickles [EMAIL PROTECTED] wrote: I need a Python IDE and debugger . . . I use vim on both Windows XP and Debian, but I used to use Komodo for big projects. Try the free trial of Komodo http://www.activestate.com/Products/komodo_ide/ It has what you want, and it comes

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Paul McGuire
On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive descent parser any more than having a recursive implementation of the factorial function. The important part is what it recurses

Re: python newbie

2007-11-03 Thread Duncan Booth
Paul Rubin http://[EMAIL PROTECTED] wrote: Duncan Booth [EMAIL PROTECTED] writes: modules are not special in any way, except that you cannot subclass them. Oops, sorry I got that wrong. Modules are not special in any way, they can have methods as well as functions: I've felt for a long

Re: MP3 and ID3 library/module recommendations

2007-11-03 Thread Basilisk96
I use PyMedia and mutagen. I've found PyMedia to be excellent for creating custom mp3 files from line input and performing frequency/energy analysis. I can't say that I've tried to convert other audio formats to MP3 with it, but I'm sure it's possible. I was able to get a working binary of

Re: Poor python and/or Zope performance on Sparc

2007-11-03 Thread George Sakkis
On Nov 3, 9:35 am, joa2212 [EMAIL PROTECTED] wrote: Result: Almost even worse. The application is not scaling at all. Every time you start a request it is hanging around on one cpu and is devouring it at about 90-100% load. The other 31 CPUs which are shown in mpstat are bored at 0% load.

Re: Copy database with python..

2007-11-03 Thread Erik Jones
On Nov 2, 2007, at 11:49 AM, Diez B. Roggisch wrote: Abandoned wrote: On Nov 2, 4:19 pm, Paul McNett [EMAIL PROTECTED] wrote: Abandoned wrote: Hi. I want to copy my database but python give me error when i use this command. cursor.execute(pg_dump mydata old.dump) What is the problem ?

jigsae puzzle issue

2007-11-03 Thread Joseph King
Hey i am trying to build a puzzle (jigsaw) game. I have most of the code for it written in python. But having an issue with one part. What i want is to give the player the ability to import there own picture and create a jigsaw from the picture with there own designation of the piece size

Re: Poor python and/or Zope performance on Sparc

2007-11-03 Thread joa2212
On 3 Nov., 17:19, George Sakkis [EMAIL PROTECTED] wrote: On Nov 3, 9:35 am, joa2212 [EMAIL PROTECTED] wrote: Result: Almost even worse. The application is not scaling at all. Every time you start a request it is hanging around on one cpu and is devouring it at about 90-100% load. The other

Re: Poor python and/or Zope performance on Sparc

2007-11-03 Thread Jean-Paul Calderone
On Sat, 03 Nov 2007 10:06:12 -0700, joa2212 [EMAIL PROTECTED] wrote: On 3 Nov., 17:19, George Sakkis [EMAIL PROTECTED] wrote: On Nov 3, 9:35 am, joa2212 [EMAIL PROTECTED] wrote: Result: Almost even worse. The application is not scaling at all. Every time you start a request it is hanging

Re: Can local function access local variables in main program?

2007-11-03 Thread Sullivan WxPyQtKinter
Actually I am quite satisfied with and error, which is my expectation. But the implicit global variable access seems quite uncomfortable to me. Why is that necessary? On Nov 3, 3:39 am, Stargaming [EMAIL PROTECTED] wrote: On Sat, 03 Nov 2007 07:18:17 +, Sullivan WxPyQtKinter wrote: I am

Re: Python IDE

2007-11-03 Thread Nick J Chackowsky
Simon Pickles wrote: Hi, I have recently moved from Windows XP to Ubuntu Gutsy. I need a Python IDE and debugger, but have yet to find one as good as Pyscripter for Windows. Can anyone recommend anything? What are you all using? Coming from a Visual Studio background, editing text

Re: Poor python and/or Zope performance on Sparc

2007-11-03 Thread Duncan Booth
Jean-Paul Calderone [EMAIL PROTECTED] wrote: The T1000 isn't a very good machine for general server purposes. It has advantages when running software with a lot of hardware-level parallelism, but Zope isn't such a piece of software. Zope can scale well on multi-processor machines, but you

how easily can glob.glob say Unix bash `echo *`

2007-11-03 Thread p . lavarre
http://wiki.python.org/moin/glob now mentions: The glob module lists names in folders that match Unix shell patterns. If the elemental function emulating Unix bash `echo *` really is missing from the 2.5 Python batteries included, then here's a brief clear way of adding that function to Python.

opinion - file.readlines blemish

2007-11-03 Thread Ken Seehart
I was just reading about the new file.newlines method that was added per PEP 278. I suspect Guido must have been looking in some other direction when this got added, because it seems unlikely to me that he would have let this get by... Okay, maybe I'm being a little harsh :-) Sorry, I'm

Re: Bizarre additional calling overhead.

2007-11-03 Thread Chris Mellon
On Sat, 2007-11-03 at 01:08 -0300, Gabriel Genellina wrote: En Fri, 02 Nov 2007 21:07:19 -0300, Matimus [EMAIL PROTECTED] escribió: On Nov 2, 3:08 pm, Chris Mellon [EMAIL PROTECTED] wrote: def test_func(): ... pass ... import new test_func2 = new.function(test_func.func_code,

Re: Retrieving all open applications ...

2007-11-03 Thread Ajay Deshpande
applications ... i need to retrieve all currently open applications ... thx for your help ... -Ajay On 10/31/07, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 30 Oct 2007 06:20:10 -0300, Ajay Deshpande [EMAIL PROTECTED] escribió: I need to retrieve all currently open applications

Re: __file__ vs __FILE__

2007-11-03 Thread klenwell
On Nov 3, 4:18 am, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: Jeff McNeil wrote: I've used the 'os.path.realpath(os.path.pardir)' construct in a couple of scripts myself. In Windows? Using Linux, this gives me ... I use os.path.dirname(os.path.abspath(__file__)) That ought to

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Neil Cerutti
On 2007-11-03, Paul McGuire [EMAIL PROTECTED] wrote: On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive descent parser any more than having a recursive implementation of the

advice for threaded/parallel application

2007-11-03 Thread Brian Blais
Hello, I am thinking about writing a simple multi-agent robot simulator, but I am stumped before I begin, trying to decide how to structure the program. My goals are the following: 1) the entire simulator should not include much beyond the standard lib. I'm comfortable with the

Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread Grant Edwards
I'm looking for GUI toolkits that work with directly with the Linux frambuffer (no X11). It's an embedded device with limited resources, and getting X out of the picture would be a big plus. The toolkit needs to be free and open-source. So far, I've found two options that will work without X11:

how to fill many data strings from socket.recvfrom()

2007-11-03 Thread lgwe
I want to receive 200 udp datagrams. Each into a new data string. But I dont know how to do that, this is wrong: import socket s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind((,port)) i = 0 while i200: data[i],addr = s.recvfrom(1024) i = +1 data[i] is illegal. Any suggestion

Re: (MAC) CoreGraphics module???

2007-11-03 Thread Robert Kern
David C. Ullrich wrote: On Fri, 02 Nov 2007 14:09:25 -0500, Robert Kern [EMAIL PROTECTED] wrote: David C. Ullrich wrote: [...] So CoreGraphics is a builtin in Apple-Python, explaining why I didn't find the relevant CoreGraphics.py anywhere on the hard drive, eh? Okay, which version of

Re: python newbie

2007-11-03 Thread Paul Rubin
Duncan Booth [EMAIL PROTECTED] writes: This isn't perfect (global variables have to be set before hooking the module) but it sort of works: - callable.py --- How to define a callable module ... Oh neat, thanks, I'll have to file that one away, and use it now and then.

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread David Bolen
Grant Edwards [EMAIL PROTECTED] writes: I'm looking for GUI toolkits that work with directly with the Linux frambuffer (no X11). It's an embedded device with limited resources, and getting X out of the picture would be a big plus. Sounds like a reasonably modern embedded system since

problem with iteration

2007-11-03 Thread Panagiotis Atmatzidis
Hello, I managed to write some code in order to do what I wanted: Inject code in the right place, in some html files. I developed the program using small functions, one at the time in order to see how they work. When I tried to put these pieces of code together I got this error: TypeError:

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread David Bolen
David Bolen [EMAIL PROTECTED] writes: When I was looking for an embedded graphics library for a prior platform (ELAN 486, 2MB flash, 6MB RAM) under DOS, we took a look at these: * GRX (http://grx.gnu.de/index.html) (...) There aren't any Python wrappers for GRX, but the library is

Re: problem with iteration

2007-11-03 Thread Paul Hankin
On Nov 3, 8:58 pm, Panagiotis Atmatzidis [EMAIL PROTECTED] wrote: Hello, I managed to write some code in order to do what I wanted: Inject code in the right place, in some html files. I developed the program using small functions, one at the time in order to see how they work. When I tried

Re: python newbie

2007-11-03 Thread Paul Hankin
On Nov 3, 8:35 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: Duncan Booth [EMAIL PROTECTED] writes: This isn't perfect (global variables have to be set before hooking the module) but it sort of works: - callable.py --- How to define a callable module ... Oh neat,

Re: how to fill many data strings from socket.recvfrom()

2007-11-03 Thread GuillaumeC
data[i] is illegal. Any suggestion welcome! Either initialize data before: data=[0]*200 before while or (better): ... i=0 data=[] for i in range(200): d,addr= s.recvfrom(1024) data.append(d) -- http://mail.python.org/mailman/listinfo/python-list

Thread structures BUG?

2007-11-03 Thread Pablo Yabo
Hello, I create lots of threads that run a script and I have a problem when a thread is created with the same threadId that existed before. When a new thread is started I use this code to enter the interpreter: // create a thread state object for this thread PyEval_AcquireLock(); threadState

Re: python newbie

2007-11-03 Thread Paul Rubin
Paul Hankin [EMAIL PROTECTED] writes: I'm intrigued - when would you want a callable module? I think it would be nice to be able to say import StringIO buf = StringIO('hello') instead of import StringIO buf = StringIO.StringIO('hello') --

Re: Can local function access local variables in main program?

2007-11-03 Thread Pawel
Stargaming wrote: You can make this work using the `global` statement:: def foo(): ... global x ... print x ... x = 0 Is there any way to disable global for x? Something like that: x = 12345 def foo(): ... global x ... print x ... noglobal(x) #

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Just Another Victim of the Ambient Morality
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive descent parser any more than having a recursive

Re: python at command prompt

2007-11-03 Thread Tim Roberts
Ton van Vliet [EMAIL PROTECTED] wrote: There's could also be an issue with entering 'python' at the command line, and not 'python.exe'. Once the PATH is setup correctly, try to enter 'python.exe', and check whether that works. IMHO, to get any 'program-name' (without the .exe extension) to work,

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread Grant Edwards
On 2007-11-03, David Bolen [EMAIL PROTECTED] wrote: Grant Edwards [EMAIL PROTECTED] writes: I'm looking for GUI toolkits that work with directly with the Linux frambuffer (no X11). It's an embedded device with limited resources, and getting X out of the picture would be a big plus. Sounds

Re: Can local function access local variables in main program?

2007-11-03 Thread Erik Jones
On Nov 3, 2007, at 5:32 PM, Pawel wrote: Stargaming wrote: You can make this work using the `global` statement:: def foo(): ... global x ... print x ... x = 0 Is there any way to disable global for x? Something like that: x = 12345 def foo(): ... global x

bsddb in python 2.5.1

2007-11-03 Thread BjornT
Have a rather big problem with bsddb I can't figure out. I upgraded an Ubuntu machine from 7.05 to 7.10 which upgraded python to 2.5.1 I run a local website that uses bsddb, and suddenly I get a version mismatch error with bsddb and I can't access my database anymore I noticed in the 2.5.1

beautiful girls will help you,why?check it out

2007-11-03 Thread brau
beautiful girls will help you,why?check it out http://groups.google.com/group/all-good-things/web/beautiful-girls-and-ladies -- http://mail.python.org/mailman/listinfo/python-list

VC Toolkit 2003

2007-11-03 Thread Jacqui Thompson
My uploaded torrent at TPB: http://thepiratebay.org/tor/3871785/Visual_Basic_Toolkit_Setup -- http://mail.python.org/mailman/listinfo/python-list

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-03, Paul McGuire [EMAIL PROTECTED] wrote: On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive

Re: how to fill many data strings from socket.recvfrom()

2007-11-03 Thread Mark T
lgwe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to receive 200 udp datagrams. Each into a new data string. But I dont know how to do that, this is wrong: import socket s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind((,port)) i = 0 while i200:

Re: Python IDE

2007-11-03 Thread Zentrader
This is a discussion on the Ubuntu forums-something like 51 pages worth. Even though you are using Gutsy, you want to take a look at KDevelop. It will install without problems even though it is KDE. A lot of people use Geany or Eclipse also. Anyway, you can page through as much of this thread

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread Bjoern Schliessmann
Grant Edwards wrote: Yes, it's modern enough to run Linux/X11 -- horsepower-wise it's sort of in the PDA class of devices. wxWidgets has been tried, but it's pretty sluggish. Hence the search for something a littler lighter weight. Erm, wxWidgets is implemented in C++ and wxPython is just a

Re: Can local function access local variables in main program?

2007-11-03 Thread Bjoern Schliessmann
Pawel wrote: Is there any way to disable global for x? Something like that: x = 12345 def foo(): ... global x ... print x ... noglobal(x) # ??? ... x = 0# now this is local x Not really. Why don't you choose meaningful variable names? You practically save nothing

Re: __file__ vs __FILE__

2007-11-03 Thread Bjoern Schliessmann
klenwell wrote: Bjoern Schliessmann wrote: I use os.path.dirname(os.path.abspath(__file__)) That makes sense, as it is almost a literal translation of what I'm used to using in PHP. Thanks for pointing this out. You're welcome, happy coding :) Regards, Björn -- BOFH excuse #286:

Re: Poor python and/or Zope performance on Sparc

2007-11-03 Thread Ivan Voras
joa2212 wrote: We have a Sun T1000 with 8 cores and 8 GB of RAM. First, I installed Solaris 10 because I know this OS better than Debian Linux. Result: poor Performance. After that I decided to migrate to debian: Do you know the architecture of this machine? It's extremely streamlined for

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread David Boddie
On Sat Nov 3 20:45:54 CET 2007, Grant Edwards wrote: I'm looking for GUI toolkits that work with directly with the Linux frambuffer (no X11). It's an embedded device with limited resources, and getting X out of the picture would be a big plus. The toolkit needs to be free and open-source.

Python good for data mining?

2007-11-03 Thread Jens
I'm starting a project in data mining, and I'm considering Python and Java as possible platforms. I'm conserned by performance. Most benchmarks report that Java is about 10-15 times faster than Python, and my own experiments confirms this. I could imagine this to become a problem for very large

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread Grant Edwards
On 2007-11-04, Bjoern Schliessmann [EMAIL PROTECTED] wrote: Grant Edwards wrote: Yes, it's modern enough to run Linux/X11 -- horsepower-wise it's sort of in the PDA class of devices. wxWidgets has been tried, but it's pretty sluggish. Hence the search for something a littler lighter weight.

Re: Python IDE

2007-11-03 Thread SPE - Stani's Python Editor
On 3 nov, 15:11, Simon Pickles [EMAIL PROTECTED] wrote: Hi, I have recently moved from Windows XP to Ubuntu Gutsy. I need a Python IDE and debugger, but have yet to find one as good as Pyscripter for Windows. Can anyone recommend anything? What are you all using? Coming from a Visual

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Neil Cerutti
On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-03, Paul McGuire [EMAIL PROTECTED] wrote: On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED]

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread Grant Edwards
On 2007-11-04, David Boddie [EMAIL PROTECTED] wrote: 1) QTopia (nee QT/Embedded). I assume that I can probably get PyQT to work with the embedded version of QT? Qtopia Core (formerly known as Qt/Embedded) should be fairly painless to get working, though the embedded-specific features

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread David Boddie
On Sun Nov 4 03:22:27 CET 2007, Grant Edwards wrote: I think we're definitely going to try to evaluate Qtopia on our platform to see if it's any quicker and smaller than wxWidgets/GTK+/X11. I guess that evaluation doesn't need to use Python -- in theory we sould be able to compare

Re: Python good for data mining?

2007-11-03 Thread Cameron Walsh
Jens wrote: I'm starting a project in data mining, and I'm considering Python and Java as possible platforms. I'm concerned by performance. Most benchmarks report that Java is about 10-15 times faster than Python, and my own experiments confirms this. I could imagine this to become a

how to iterate through each set

2007-11-03 Thread Tom_chicollegeboy
I am begginer in learning Python language. My assignment is to iterate through each set and display results. this is text of assignment: Bill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know how many miles they have driven. Fortunately, Bill has a

Re: how to iterate through each set

2007-11-03 Thread Cameron Walsh
Tom_chicollegeboy wrote: snip! Here is my code: def speed(): infile = open('speed.in', 'r') line = infile.readline() read = int(line) print line i = 0 t0 = 0 v = 0 while iread: line = infile.readline() list = line.split()

Re: how to iterate through each set

2007-11-03 Thread Tom_chicollegeboy
On Nov 4, 12:18 am, Cameron Walsh [EMAIL PROTECTED] wrote: Tom_chicollegeboy wrote: snip! Here is my code: def speed(): infile = open('speed.in', 'r') line = infile.readline() read = int(line) print line i = 0 t0 = 0 v = 0 while iread:

Re: how to iterate through each set

2007-11-03 Thread Tom_chicollegeboy
On Nov 4, 12:47 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Sat, 03 Nov 2007 21:30:10 -0700, Tom_chicollegeboy [EMAIL PROTECTED] declaimed the following in comp.lang.python: It works only for first set. How should I implement another solution that would move program to read next

Re: Low-overhead GUI toolkit for Linux w/o X11?

2007-11-03 Thread Paul Rubin
Grant Edwards [EMAIL PROTECTED] writes: There is no mouse. I'm not sure how many widgets are required. Probably not very many. Back in the old days there were some lightweight toolkits for doing text mode GUI's using ANSI graphic characters for MS-DOS. I did a few of them. You could do

[issue1372] zlibmodule.c: int overflow in PyZlib_decompress

2007-11-03 Thread Peter Weseloh
Peter Weseloh added the comment: You are right. The format should be 'l'. I overlooked that. In my case the optional 'buf_size' parameter of 'decompress' is not used anyhow. Shall I change the patch accordingly? It work well for me and I now checked the code of PyArg_ParseTuple

[issue1376] uu module catches a wrong exception type

2007-11-03 Thread Guido van Rossum
Guido van Rossum added the comment: You misunderstand. The try/except is there in case os.stat isn't defined or its result doesn't have a st_mode attribute. If the stat operation fails due to a problem with the file, there's not much point in proceeding since the subsequent open() call would

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-03 Thread roudkerk
New submission from roudkerk: The patch adds support for _socket.fromfd() and _socket.socket.dup() on Windows. It uses the Win32 DuplicateHandle() function. The patch is to socketmodule.c an test_socket.py. -- files: socket_fromfd.patch messages: 57084 nosy: roudkerk severity: normal

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-03 Thread Martin v. Löwis
Changes by Martin v. Löwis: -- keywords: +patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1378 __ ___ Python-bugs-list mailing list Unsubscribe:

[issue1379] reloading imported modules sometimes fail with 'parent not in sys.modules' error

2007-11-03 Thread Martin v. Löwis
Changes by Martin v. Löwis: -- keywords: +patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1379 __ ___ Python-bugs-list mailing list Unsubscribe:

[issue1380] fix for test_asynchat and test_asyncore on pep3137 branch

2007-11-03 Thread Adam Hupp
New submission from Adam Hupp: The attached patch resolves test failues in test_asynchat and test_asyncore. The asynchat failure was due to interpolating a byte string into a unicode string using %s. This resulted in a b'' byte representation in the final string. The fix is to use string

[issue1380] fix for test_asynchat and test_asyncore on pep3137 branch

2007-11-03 Thread Christian Heimes
Christian Heimes added the comment: Applied in r58831 Thanks! -- keywords: +patch, py3k nosy: +tiran resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1380 __

[issue1381] cmath is numerically unsound

2007-11-03 Thread Andreas Kloeckner
New submission from Andreas Kloeckner: This here basically says it all: import cmath;[cmath.asinh(i*1e-17).real for i in range(0,20)] [4.4408920985006257e-16, 4.4408920985006257e-16, 4.4408920985006257e-16, 4.4408920985006257e-16, 4.4408920985006257e-16, 4.4408920985006257e-16,

[issue1381] cmath is numerically unsound

2007-11-03 Thread Martin v. Löwis
Martin v. Löwis added the comment: Can you propose a patch? -- nosy: +loewis __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1381 __ ___ Python-bugs-list mailing list

[issue1381] cmath is numerically unsound

2007-11-03 Thread Andreas Kloeckner
Andreas Kloeckner added the comment: On Samstag 03 November 2007, Martin v. Löwis wrote: Martin v. Löwis added the comment: Can you propose a patch? Other than point at how boost.math does things, I don't have the time to work on this right now, sorry. Andreas

[issue1372] zlibmodule.c: int overflow in PyZlib_decompress

2007-11-03 Thread Guido van Rossum
Changes by Guido van Rossum: Removed file: http://bugs.python.org/file8681/unnamed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1372 __ ___ Python-bugs-list mailing list

[issue1372] zlibmodule.c: int overflow in PyZlib_decompress

2007-11-03 Thread Guido van Rossum
Guido van Rossum added the comment: The correct format for a Py_ssize_t is 'n' (at least in the trunk, I don't have the 2.5 branch handy but I imagine it's the same). We can figure out the patch from here. __ Tracker [EMAIL PROTECTED]

[issue1381] cmath is numerically unsound

2007-11-03 Thread Alan McIntyre
Alan McIntyre added the comment: I have to review a few complex math topics for some of my current course work, so I wouldn't mind taking a look into this. I can't promise I'll have the time required to make all of cmath correct (assuming it's as unsound as claimed), but I'll do what I can.