line_profiler and kernprof 1.0b2

2009-02-19 Thread Robert Kern
line_profiler is a module for doing line-by-line profiling of functions. kernprof is a convenient script for running either line_profiler or the standard library's cProfile module. Download: http://pypi.python.org/pypi/line_profiler Docs: http://packages.python.org/line_profiler HG Repo:

Re: Delete lines which contain string in a file

2009-02-19 Thread Chris
On Feb 19, 12:24 am, Steve Holden st...@holdenweb.com wrote: Rudi Goldman wrote: Hi, Go easy on me as I am a new to Python and am trying to solve a practical problem that is driving me bananas. Basically I have 2 text files, a source and a target. I want to be able to delete all of the

Re: Python 3D CAD -- need collaborators, or just brave souls :)

2009-02-19 Thread Lie
On Feb 18, 8:02 pm, r rt8...@gmail.com wrote: Hello Josh, Blender is a lost cause. It is a powerful app but the UI is horrible. Even the Blender folks admit only a complete rewrite could solve the major flaws that plague the designCITATION NEEDED. So maybe i could salvage some code but for

Re: Calling a class instance like a function

2009-02-19 Thread Bruno Desthuilliers
Uberman a écrit : I'm wondering if there's a way to invoke a function operator on a Python class instance. For example, given a class instance: myClass = MyClass() I want to call that instance like a function, with an argument value: myClass(5.0) I can override the ()

Re: block dynamic attribute creation

2009-02-19 Thread Bruno Desthuilliers
Alan G Isaac a écrit : On 2/18/2009 6:15 PM Gabriel Genellina apparently wrote: type(a).x OK, that's good. I'd like to sometimes lock attribute creation on instances of a class but still allow properties to function correctly. Will something like below be satisfactory? def

Re: os.popen encoding!

2009-02-19 Thread Gabriel Genellina
En Wed, 18 Feb 2009 22:38:45 -0200, SMALLp po...@email.t-com.hr escribió: Thanks for help! My problem was actualy: a = [velja\xe8a 2009] print a#will print [velja\xe8a 2009] Print a[0]#will print veljaèa 2009 And why is that a problem? Almost the only reason to print a list is

Re: v 3.0 mpkg

2009-02-19 Thread Ned Deily
In article 7a9c25c20902182335n226e4496vce023b1627baa...@mail.gmail.com, Stephen Hansen apt.shan...@gmail.com wrote: Follow up: Python 3.0.1 has been released and, with it, an installer image for OS X: http://www.python.org/download/releases/3.0.1/ How doe the 3.0 installer on the mac

Re: block dynamic attribute creation (was: get descriptor from instance)

2009-02-19 Thread Gabriel Genellina
En Thu, 19 Feb 2009 01:29:17 -0200, Alan G Isaac alan.is...@gmail.com escribió: OK, that's good. I'd like to sometimes lock attribute creation on instances of a class but still allow properties to function correctly. Will something like below be satisfactory? def __setattr__(self, attr,

Re: How to convert between Japanese coding systems?

2009-02-19 Thread Justin Ezequiel
On Feb 19, 2:28 pm, Dietrich Bollmann dir...@web.de wrote: Are there any functions in python to convert between different Japanese coding systems? I would like to convert between (at least) ISO-2022-JP, UTF-8, EUC-JP and SJIS.  I also need some function to encode / decode base64 encoded

Re: can multi-core improve single funciton?

2009-02-19 Thread Gabriel Genellina
En Wed, 18 Feb 2009 23:36:25 -0200, sturlamolden sturlamol...@yahoo.no escribió: On Feb 10, 7:28 am, oyster lepto.pyt...@gmail.com wrote: Let's rewrite that slightly and see... def fib(n, _map=None): if not _map: _map = map if n 2: return sum(_map(fib, (n-1, n-2))) else:

Re: Pythonic way to determine if one char of many in a string

2009-02-19 Thread John Machin
On Feb 19, 6:47 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Wed, 18 Feb 2009 21:22:45 +0100, Peter Otten __pete...@web.de declaimed the following in comp.lang.python: Steve Holden wrote: Jervis Whitley wrote: What happens when you have hundreds of megabytes, I don't know.

Re: Threading and tkinter

2009-02-19 Thread gert
On Feb 19, 3:20 am, Steve Holden st...@holdenweb.com wrote: gert wrote: Can you first explain why x stay's 0 please and how i should update x using threads ? fromtkinterimport * from _thread import start_new_thread from time import sleep x=0 def weegbrug(x):     while True:    

Re: How to convert between Japanese coding systems?

2009-02-19 Thread Justin Ezequiel
import email from email.Header import decode_header from unicodedata import name as un MS = '''\ Subject: =?UTF-8?Q? romaji=E3=81=B2=E3=82=89=E3=81=8C=E3=81=AA=E3=82=AB=E3=82=BF?= Date: Thu, 19 Feb 2009 09:34:56 - MIME-Version: 1.0 Content-Type: text/plain; charset=EUC-JP

Re: Threading and tkinter

2009-02-19 Thread Hendrik van Rooyen
gert gert...@gmail.com wrote: On Feb 18, 8:25 am, Hendrik van Rooyen m...@microcorp.co.za wrote: gert gert.cuyk...@gmail.comwrote: After reading the docs and seeing a few examples i think this should work ? Am I forgetting something here or am I doing something stupid ? Anyway I

Re: how to list all installed modules

2009-02-19 Thread harryos
On Feb 18, 11:10 pm, Scott David Daniels scott.dani...@acm.org Are you running F:\Python25\python.exe (or F:\Python25\pythonw.exe)? open a command window (run cmd), and type:      C:\ python      ...       import sys       for dirname in  sys.path:              print sys.path I suspect

Re: Newbie Q about Turtle Gfx

2009-02-19 Thread Neil
Hi It turns out I should have used t=turtle.Pen() and not t=turtle.pen() My stupid mistake! Neil rubik_wiz...@no.spamhotmail.com wrote in message news:jyydnb8xe8hpoghunz2dnuvz8juwn...@bt.com... Thanks everyone! It appears the info in the book is wrong. Trying what you have all

cx Oracle privileges

2009-02-19 Thread Slafs
Hello On my Debian server I'm using cx Oracle 5.1 (installation from a package made from rpm by alien) with Python 2.5.2 and Oracle Instant Client 10.2.0.4.0. Installation went well but simple test such as connecting to the db shows that only user root can make a connection to a database, but any

Re: can multi-core improve single funciton?

2009-02-19 Thread Paul Rubin
Gabriel Genellina gagsl-...@yahoo.com.ar writes: Even my Pentium I MMX 233MHz can compute fib(36) thousand of times faster than that with the right algorithm. So I don't see the point in parallelizing if you're going to get infinitely worse results... The point is to test the parallelization

Re: Will multithreading make python less popular?

2009-02-19 Thread rushenaly
Thank you for all your answers... I think i am going to pick Java instead of Python... Rushen -- http://mail.python.org/mailman/listinfo/python-list

Re: SVN/CVS and Branching

2009-02-19 Thread Jeff Dyke
Fair enough. Say my project is called foo, and it has many submodules. So there are imports that may look like `import foo.bar` or `from foo.bar import baz`, if i change the top level directory, it is no longer foo and then those imports do not work as originally written. The way i currently do

Re: Pythonic way to determine if one char of many in a string

2009-02-19 Thread MRAB
Dennis Lee Bieber wrote: On Wed, 18 Feb 2009 21:22:45 +0100, Peter Otten __pete...@web.de declaimed the following in comp.lang.python: Steve Holden wrote: Jervis Whitley wrote: What happens when you have hundreds of megabytes, I don't know. I hope I never have to test a word that is

string to list conversion

2009-02-19 Thread John Forse
I need to convert an input string say '' to a list of the form ['' ,]. If I use list(stringname), I get ['x','x','x','x'] ; list.join() is an error; and str.join() won't use lists. I do need the comma after the string. Is there a simple solution? Regards John --

Porting to new Python version

2009-02-19 Thread Gabor Urban
Hi, I have a tough issue: we are using a Python application written quite a time ago for version 2.4. The code is mature, and there are no bugs. My bosses came up with the idea to port it to the latest release... I am not really convinced that it's a good step. I wellcome any information pro

Re: Pythonic way to determine if one char of many in a string

2009-02-19 Thread Martin P. Hellwig
MRAB wrote: Dennis Lee Bieber wrote: On Wed, 18 Feb 2009 21:22:45 +0100, Peter Otten __pete...@web.de declaimed the following in comp.lang.python: Steve Holden wrote: Jervis Whitley wrote: What happens when you have hundreds of megabytes, I don't know. I hope I never have to test a word

Re: SVN/CVS and Branching

2009-02-19 Thread David Stanek
On Thu, Feb 19, 2009 at 7:10 AM, Jeff Dyke jeff.d...@gmail.com wrote: Fair enough. Say my project is called foo, and it has many submodules. So there are imports that may look like `import foo.bar` or `from foo.bar import baz`, if i change the top level directory, it is no longer foo and

Re: Will multithreading make python less popular?

2009-02-19 Thread Steve Holden
rushen...@gmail.com wrote: Thank you for all your answers... I think i am going to pick Java instead of Python... Well, good luck. See what a helpful bunch of people you meet in the Python world? Glad you found all the advice helpful. Come back when you want to try Python! regards Steve --

Re: urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-02-19 Thread O Peng
I'm running into a similar problem with the BadStatusLine. The source code for httplib.py in the problem is as follows: class HTTPResponse: ... def _read_status(self): line = self.fp.readline() ... if not line: # Presumably, the server closed the

metaclass conflict error: where is noconflict ?

2009-02-19 Thread Barak, Ron
Hi, I have a class derived from two parents (in blue below), which gives me the following error: $ python -u ./failover_pickle_demo09.py Traceback (most recent call last): File ./failover_pickle_demo09.py, line 291, in module class ListControl(wx.Frame, CopyAndPaste): TypeError: Error

Creating a request for ZSI

2009-02-19 Thread Kevin Geraghty
Folks, I am trying to access a WSDL and I used wsdl2py to create the needed files. My problem is that when I try to create a request object I get a request Holder object instead. get_rates_by_profile_name=ns0.get_rates_by_profile_name_Dec().pyclass req=get_rates_by_profile_name()

Re: SVN/CVS and Branching

2009-02-19 Thread Jeff Dyke
On Thu, Feb 19, 2009 at 7:57 AM, David Stanek dsta...@dstanek.com wrote: On Thu, Feb 19, 2009 at 7:10 AM, Jeff Dyke jeff.d...@gmail.com wrote: Fair enough. Say my project is called foo, and it has many submodules. So there are imports that may look like `import foo.bar` or `from foo.bar

Re: string to list conversion

2009-02-19 Thread Steve Holden
John Forse wrote: I need to convert an input string say '' to a list of the form ['' ,]. If I use list(stringname), I get ['x','x','x','x'] ; list.join() is an error; and str.join() won't use lists. I do need the comma after the string. Is there a simple solution? Suppose your input

Re: string to list conversion

2009-02-19 Thread MRAB
John Forse wrote: I need to convert an input string say '' to a list of the form ['' ,]. If I use list(stringname), I get ['x','x','x','x'] ; list.join() is an error; and str.join() won't use lists. I do need the comma after the string. Is there a simple solution? Have you tried

Re: Porting to new Python version

2009-02-19 Thread Kottiyath
On Feb 19, 5:50 pm, Gabor Urban urbang...@gmail.com wrote: Hi, I have a tough issue: we are using a Python application written quite a time ago for version 2.4. The code is mature, and there are no bugs.  My bosses came up with the idea to port it to the latest release... I am not really

Re: Porting to new Python version

2009-02-19 Thread andrew cooke
i don't know what the context is, so it's hard for me to comment on the decision (i assume there are commerical pressures like customers not wanting to install old versions). however,if you go ahead, you need to think about exactly what you want to target. the latest version is really 3.0.1.

Re: Porting to new Python version

2009-02-19 Thread Steve Holden
Gabor Urban wrote: Hi, I have a tough issue: we are using a Python application written quite a time ago for version 2.4. The code is mature, and there are no bugs. My bosses came up with the idea to port it to the latest release... I am not really convinced that it's a good step. I

Re: Porting to new Python version

2009-02-19 Thread andrew cooke
maybe i should clarify that easy below is going to be relative. the process may end up being very hard due to various other reasons. what i was trying to explain is that (1) 3 is probably going to require a separate branch from 2; (2) that 2.6 and 3 can both be considered latest; (3) moving

Re: string to list conversion

2009-02-19 Thread Srinivas
John, Try the following code .. hope this helps and solves your problem . I have run in the interactive mode s='' a=[s,'12'] print a ['', '12'] regards Srinivas -- http://mail.python.org/mailman/listinfo/python-list

Re: Revision Control

2009-02-19 Thread Dikkie Dik
Funny how everybody is speaking about the ease of merging. It is the very least feature I have ever needed from source code control. Most version control system are really brilliant in creating a version mess of intertwined branches, but off course I use version control to *PREVENT* such a mess.

Re: How to convert between Japanese coding systems?

2009-02-19 Thread Lie Ryan
On Thu, 19 Feb 2009 15:28:12 +0900, Dietrich Bollmann wrote: Hi, Are there any functions in python to convert between different Japanese coding systems? If I'm not mistaken, the email standard specifies that only 7-bit ASCII- encoded bytes can be transported safely and reliably. The highest

Re: Revision Control

2009-02-19 Thread Scott David Daniels
Dikkie Dik wrote: Funny how everybody is speaking about the ease of merging. It is the very least feature I have ever needed from source code control Ah yes, but with a distributed VCS, merging becomes _much_ more common. The model is developers pull, develop (checking in frequently), and

CSV readers and UTF-8 files

2009-02-19 Thread mk
Hello everyone, Is it just me or CSV reader/DictReader and UTF-8 files do not work correctly in Python 2.6.1 (Windows)? That is, when I open UTF-8 file in a csv reader (after passing plain file object), I get fields as plain strings ('str'). Since this has been mangled, I can't get the

Which Version of wxPython for Win XP

2009-02-19 Thread W. eWatson
I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice has unicode. Do I care? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121°

Re: Revision Control

2009-02-19 Thread Tim Chase
FWIW, Bazaar and Mercurial both have about half a dozen C modules. (Most of Bazaar's are Pyrex, though, not straight C.) Thanks for the update -- it's been about 6 months since I played much with Bazaar. Hopefully these C module help with some of the speed issues that plagued bzr in my past

Re: Porting to new Python version

2009-02-19 Thread Michele Simionato
On Feb 19, 1:50 pm, Gabor Urban urbang...@gmail.com wrote: Hi, I have a tough issue: we are using a Python application written quite a time ago for version 2.4. The code is mature, and there are no bugs.  My bosses came up with the idea to port it to the latest release... I am not really

Why deepcopy with class with __getattr__ makes the tracing go nuts?

2009-02-19 Thread Fabio Zadrozny
Anyone has any idea why the code attached does not work? Basically, after doing the deepcopy of the class that has __getattr__ overridden, the python tracing facilities don't seem to work anymore. In the code-attached, if the deepcopy is removed, all works as expected (or if __deepcopy__ is

Re: PIL install driving me mad! With solution!

2009-02-19 Thread Hendrik van Rooyen
bleah jo...@ph...arizona.edu wrote: I'm trying to get PIL 1.16 installed on a SUSE SLES10 system, and cannot, for the life of me, get the thing to compile with jpeg support. The libjpeg-devel libraries are installed, and are present in /usr/lib JUST WHERE SPECIFIED in the setup.py file, and the

Re: Revision Control

2009-02-19 Thread Roy Smith
In article 499d5f0e$0$444$bf494...@news.tele2.nl, Dikkie Dik dik...@nospam.org wrote: Funny how everybody is speaking about the ease of merging. It is the very least feature I have ever needed from source code control. It depends on what you're doing. In a big commercial project, sometimes

Re: can multi-core improve single funciton?

2009-02-19 Thread Cameron Laird
In article pan.2009.02.18.07.24...@remove.this.cybersource.com.au, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: . . . And now for my version (which admitedly isn't really mine, and returns slightly incorrect

Re: block dynamic attribute creation

2009-02-19 Thread Alan G Isaac
if hasattr(self, attr): #update val self.__dict__[attr] = val On 2/19/2009 3:54 AM Gabriel Genellina apparently wrote: In particular, your code prevents using class attributes as a default value for instance attributes Doesn't the above allow that? Thanks, Alan --

Re: Musings: Using decorators to reduce duplicate exception handling

2009-02-19 Thread J Kenneth King
Cameron Simpson c...@zip.com.au writes: On 17Feb2009 15:12, J Kenneth King ja...@agentultra.com wrote: | I recently started a project called TracShell | (http://code.google.com/p/tracshell) where I make heavy use of the | xmlrpclib core module. | | When the number of RPC calls was small,

Re: Will multithreading make python less popular?

2009-02-19 Thread rushenaly
Thank you Steve, I really wanted to learn python, but as i said i don't want to make a dead investment. I hope someone can fix these design errors and maybe can write an interpreter in python :) Thank you so much great community... Rushen -- http://mail.python.org/mailman/listinfo/python-list

Re: Why deepcopy with class with __getattr__ makes the tracing go nuts?

2009-02-19 Thread Peter Otten
Fabio Zadrozny wrote: Anyone has any idea why the code attached does not work? Basically, after doing the deepcopy of the class that has __getattr__ overridden, the python tracing facilities don't seem to work anymore. In the code-attached, if the deepcopy is removed, all works as

Re: Will multithreading make python less popular?

2009-02-19 Thread Tim Rowe
2009/2/19 rushen...@gmail.com: Thank you Steve, I really wanted to learn python, but as i said i don't want to make a dead investment. I hope someone can fix these design errors and maybe can write an interpreter in python :) Good luck with Java, and with your search for a perfect language.

Re: Will multithreading make python less popular?

2009-02-19 Thread Christian Heimes
rushen...@gmail.com schrieb: Thank you Steve, I really wanted to learn python, but as i said i don't want to make a dead investment. I hope someone can fix these design errors and maybe can write an interpreter in python :) Good luck with Java! You have just traded one design flaw for

Re: Which Version of wxPython for Win XP

2009-02-19 Thread eric_dex...@msn.com
On Feb 19, 8:22 am, W. eWatson notval...@sbcglobal.net wrote: I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice has unicode. Do I care? --                                 W. eWatson               (121.015 Deg. W, 39.262 Deg.

Re: Will multithreading make python less popular?

2009-02-19 Thread rushenaly
Thank you Tim... It is not a search for perfect language. It is a search for a capable language to modern worlds' needs. Rushen -- http://mail.python.org/mailman/listinfo/python-list

Re: CSV readers and UTF-8 files

2009-02-19 Thread Falcolas
On Feb 19, 7:21 am, mk mrk...@gmail.com wrote: Hello everyone, Is it just me or CSV reader/DictReader and UTF-8 files do not work correctly in Python 2.6.1 (Windows)? I would point out in the CSV module documentation (http:// docs.python.org/library/csv.html) it explicitly mentions that it

Re: PyGTK install

2009-02-19 Thread Eric_Dexter
On Feb 18, 5:12 pm, Lionel lionel.ke...@gmail.com wrote: On Feb 18, 3:03 pm, Lionel lionel.ke...@gmail.com wrote: On Feb 18, 2:08 pm, Lionel lionel.ke...@gmail.com wrote: On Feb 18, 11:43 am, Lionel lionel.ke...@gmail.com wrote: Hello folks, I couldn't find a specific PyGTK forum

os.fdopen giving Invalid Argument from pipes

2009-02-19 Thread Tim Wintle
Was wondering if someone could point out what the stupid thing I'm doing wrong is: {{{ import os, time def run_multi_proc(): server_send, logger_recieve = os.pipe() pid = os.fork() if pid == 0: # we are the logger #os.close(server_send) logger_recieve =

Re: Which Version of wxPython for Win XP

2009-02-19 Thread W. eWatson
eric_dex...@msn.com wrote: On Feb 19, 8:22 am, W. eWatson notval...@sbcglobal.net wrote: I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice has unicode. Do I care? -- W. eWatson

Re: Will multithreading make python less popular?

2009-02-19 Thread Tim Rowe
2009/2/19 rushen...@gmail.com: Thank you Tim... It is not a search for perfect language. It is a search for a capable language to modern worlds' needs. That would be just about any of the ones you mentioned, then. Unless you mean the needs of a specific project, in which case the suitability

Re: os.fdopen giving Invalid Argument from pipes

2009-02-19 Thread Jean-Paul Calderone
On Thu, 19 Feb 2009 16:37:49 +, Tim Wintle tim.win...@teamrubber.com wrote: Was wondering if someone could point out what the stupid thing I'm doing wrong is: {{{ import os, time def run_multi_proc(): server_send, logger_recieve = os.pipe() You got server_send and logger_receive

Re: os.fdopen giving Invalid Argument from pipes

2009-02-19 Thread Tim Wintle
On Thu, 2009-02-19 at 11:50 -0500, Jean-Paul Calderone wrote: You got server_send and logger_receive backwards Doh! (also, i before e *except* after c et cetera). Flip 'em around and all is well. Thanks - never was great at speling :-) Tim --

Re: Will multithreading make python less popular?

2009-02-19 Thread sturlamolden
On Feb 19, 4:39 pm, rushen...@gmail.com wrote: I really wanted to learn python, but as i said i don't want to make a dead investment. I hope someone can fix these design errors and maybe can write an interpreter in python :) Java and Python has different strengths and weaknesses. There is no

setattr question

2009-02-19 Thread TP
Hi everybody, I try to make a link (or shortcut, if you want) so that len(b_instance) computes in fact len(a) (see the code below). I could write a method __len__ to b, but I wonder if it is possible to make it with a setattr/getattr trick, as I do below. Thanks in advance, Julien

Re: Will multithreading make python less popular?

2009-02-19 Thread Richard Brodie
sturlamolden sturlamol...@yahoo.no wrote in message news:d544d846-15ac-446e-a77f-cede8fcf9...@m40g2000yqh.googlegroups.com... The GIL does not matter before crunching numbers on the CPU becomes the bottleneck. And when you finally get there, perhaps it is time to look into some C

Search in list of dictionaries

2009-02-19 Thread Alex Gusarov
Hello everybody! I've a list of dictionaries with 'shorcut' and 'command' keys. When user types a word program must search this list for a typed shortcut and then run linked command. What I've wrote: for cmd in self.commands: if cmd['shortcut'] == input:

Re: Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

2009-02-19 Thread Helly John J.
Hi Miles. Same result from that as well. Cheers. -- John Helly, University of California, San Diego San Diego Supercomputer Center Scripps Institution of Oceanography 9500 Gilman Dr. Mail Code, La Jolla CA 92093 Phone: Voice +01 760 840 8660 mobile / stonesteps (Skype) /

Re: Which Version of wxPython for Win XP

2009-02-19 Thread W. eWatson
W. eWatson wrote: eric_dex...@msn.com wrote: On Feb 19, 8:22 am, W. eWatson notval...@sbcglobal.net wrote: I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice has unicode. Do I care? -- W. eWatson

Re: Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

2009-02-19 Thread Helly John J.
Hi Philip. I installed the 2.5.4 binary from the python.org site. I did this because NumPy and SciPy currently only work with 2.5 and the system version was 2.4. Cheers. -- John Helly, University of California, San Diego San Diego Supercomputer Center Scripps Institution of

Re: numpy.memmap advice?

2009-02-19 Thread Lionel
On Feb 18, 12:35 pm, Carl Banks pavlovevide...@gmail.com wrote: On Feb 18, 10:48 am, Lionel lionel.ke...@gmail.com wrote: Thanks Carl, I like your solution. Am I correct in my understanding that memory is allocated at the slicing step in your example i.e. when reshaped_data is sliced using

Re: Search in list of dictionaries

2009-02-19 Thread MRAB
Alex Gusarov wrote: Hello everybody! I've a list of dictionaries with 'shorcut' and 'command' keys. When user types a word program must search this list for a typed shortcut and then run linked command. What I've wrote: for cmd in self.commands: if cmd['shortcut'] ==

Re: setattr question

2009-02-19 Thread Peter Otten
TP wrote: Hi everybody, I try to make a link (or shortcut, if you want) so that len(b_instance) computes in fact len(a) (see the code below). I could write a method __len__ to b, but I wonder if it is possible to make it with a setattr/getattr trick, as I do below. Thanks in advance,

Re: block dynamic attribute creation

2009-02-19 Thread Gabriel Genellina
En Thu, 19 Feb 2009 13:20:25 -0200, Alan G Isaac alan.is...@gmail.com escribió: if hasattr(self, attr): #update val self.__dict__[attr] = val On 2/19/2009 3:54 AM Gabriel Genellina apparently wrote: In particular, your code prevents using class attributes as a default

Re: Search in list of dictionaries

2009-02-19 Thread Alex Gusarov
Thanks! This example is quite simple and works exactly the way I wanted. On Thu, Feb 19, 2009 at 11:39 PM, MRAB goo...@mrabarnett.plus.com wrote: Alex Gusarov wrote: Hello everybody! I've a list of dictionaries with 'shorcut' and 'command' keys. When user types a word program must search

Re: numpy.memmap advice?

2009-02-19 Thread Carl Banks
On Feb 19, 9:34 am, Lionel lionel.ke...@gmail.com wrote: On Feb 18, 12:35 pm, Carl Banks pavlovevide...@gmail.com wrote: On Feb 18, 10:48 am, Lionel lionel.ke...@gmail.com wrote: Thanks Carl, I like your solution. Am I correct in my understanding that memory is allocated at the

Re: numpy.memmap advice?

2009-02-19 Thread sturlamolden
On 19 Feb, 03:13, Carl Banks pavlovevide...@gmail.com wrote: The offset parameter of mmap itself would be useful to map small portions of gigabyte-sized files, and maybe numpy.memmap can take advantage of that if the user passes an offset parameter.   NumPy's memmap is just a wrapper for

Re: Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

2009-02-19 Thread Philip Semanchuk
On Feb 19, 2009, at 12:30 PM, Helly John J. wrote: Hi Philip. I installed the 2.5.4 binary from the python.org site. I did this because NumPy and SciPy currently only work with 2.5 and the system version was 2.4. It looks like you're using the same Python at the command line as the

Re: programming by evolution?

2009-02-19 Thread Albert van der Horst
In article 03db1c69-828a-4961-914d-62fe10ed8...@w39g2000prb.googlegroups.com, Xah Lee xah...@gmail.com wrote: SNIP Pascal Constanza wrote: Yes. There are actually complete software development methodologies built around these ideas. Google for extreme programming and agile software

Re: Which Version of wxPython for Win XP

2009-02-19 Thread Mike Driscoll
On Feb 19, 11:29 am, W. eWatson notval...@sbcglobal.net wrote: W. eWatson wrote: eric_dex...@msn.com wrote: On Feb 19, 8:22 am, W. eWatson notval...@sbcglobal.net wrote: I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice

Re: numpy.memmap advice?

2009-02-19 Thread Carl Banks
On Feb 19, 10:00 am, sturlamolden sturlamol...@yahoo.no wrote: On 19 Feb, 03:13, Carl Banks pavlovevide...@gmail.com wrote: The offset parameter of mmap itself would be useful to map small portions of gigabyte-sized files, and maybe numpy.memmap can take advantage of that if the user

Newby Question for reading a file

2009-02-19 Thread steven.oldner
Simple question but I haven't found an answer. I program in ABAP, and in ABAP you define the data structure of the file and move the file line into the structure, and then do something to the fields. That's my mental reference. How do I separate or address each field in the file line with

Re: Threading and tkinter

2009-02-19 Thread gert
Hope you do not mind ignoring part of answers, so I can figure out more why things work the way they are. This two examples work, what i do not understand is that in function display i do not have to declare root, v or x ? -- example 1 -- from tkinter import * from _thread import

Re: numpy.memmap advice?

2009-02-19 Thread Lionel
On Feb 19, 9:51 am, Carl Banks pavlovevide...@gmail.com wrote: On Feb 19, 9:34 am, Lionel lionel.ke...@gmail.com wrote: On Feb 18, 12:35 pm, Carl Banks pavlovevide...@gmail.com wrote: On Feb 18, 10:48 am, Lionel lionel.ke...@gmail.com wrote: Thanks Carl, I like your solution. Am I

Re: Newby Question for reading a file

2009-02-19 Thread Mike Driscoll
On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I haven't found an answer.  I program in ABAP, and in ABAP you define the data structure of the file and move the file line into the structure, and then do something to the fields.  That's my mental

Re: block dynamic attribute creation

2009-02-19 Thread Alan G Isaac
On 2/19/2009 3:47 AM Bruno Desthuilliers apparently wrote: if not hasattr(self, attr) and getattr(self, '_attrlock', False): raise AttributeError(yadda yadda) # NB: assume newstyle class super(YourClass, self).__setattr__(attr, val) Thanks. Alan PS Thanks also to all

Re: Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

2009-02-19 Thread Ned Deily
In article f71b1e4c-87a5-41dd-aa9a-92687223f...@ucsd.edu, Helly John J. hel...@ucsd.edu wrote: I installed the 2.5.4 binary from the python.org site. I did this because NumPy and SciPy currently only work with 2.5 and the system version was 2.4. [...] On Feb 16, 2009, at 8:35 PM, Helly

Strange array.array performance

2009-02-19 Thread Maxim Khitrov
Hello all, I'm currently writing a Python - MATLAB interface with ctypes and array.array class, using which I'll need to push large amounts of data to MATLAB. Everything is working well, but there was one strange performance-related issue that I ran into and wanted to ask about. Here's some

reading binary data from a 32 bit machine on 64 bit machine

2009-02-19 Thread harijay
Hi I am very confused with the use of the struct module to read binary data from a file. ( I have only worked with ascii files so far) I have a file spec for a Data-logger (http://www.dataq.com/support/ techinfo/ff.htm) I am collecting some voltage , time traces on one channel and they are

Regular expression bug?

2009-02-19 Thread Ron Garret
I'm trying to split a CamelCase string into its constituent components. This kind of works: re.split('[a-z][A-Z]', 'fooBarBaz') ['fo', 'a', 'az'] but it consumes the boundary characters. To fix this I tried using lookahead and lookbehind patterns instead, but it doesn't work:

Re: Newby Question for reading a file

2009-02-19 Thread steven.oldner
On Feb 19, 12:40 pm, Mike Driscoll kyoso...@gmail.com wrote: On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I haven't found an answer.  I program in ABAP, and in ABAP you define the data structure of the file and move the file line into the structure,

Re: Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

2009-02-19 Thread Ned Deily
In article nad-d1a1b2.10514619022...@ger.gmane.org, Ned Deily n...@acm.org wrote: It looks like you have installed GDAL to the site-packages directory of the Apple-supplied python 2.5 (which, for 10.5, is 2.5.1, not 2.4). That site-packages directory is /Library/Python/2.5. The

Re: Strange array.array performance

2009-02-19 Thread Gabriel Genellina
En Thu, 19 Feb 2009 16:52:54 -0200, Maxim Khitrov mkhit...@gmail.com escribió: input = array('B', range(256) * 1) # Case 1 start = clock() data1 = array('B', input) print format(clock() - start, '.10f') That seems very wrong. In the end, all arrays have the same data, but by

Regression test test_site failed on current trunk

2009-02-19 Thread Andy
Hi, I checked out the python trunk (curently 2.7a0), compiled it on my linux machine and run the regression test suit. Below is the output of the failed part: test_site [14871 refs] test test_site failed -- Traceback (most recent call last): File

Re: Regular expression bug?

2009-02-19 Thread Albert Hopkins
On Thu, 2009-02-19 at 10:55 -0800, Ron Garret wrote: I'm trying to split a CamelCase string into its constituent components. This kind of works: re.split('[a-z][A-Z]', 'fooBarBaz') ['fo', 'a', 'az'] but it consumes the boundary characters. To fix this I tried using lookahead and

Re: Strange array.array performance

2009-02-19 Thread Robert Kern
On 2009-02-19 12:52, Maxim Khitrov wrote: Hello all, I'm currently writing a Python- MATLAB interface with ctypes and array.array class, using which I'll need to push large amounts of data to MATLAB. Have you taken a look at mlabwrap? http://mlabwrap.sourceforge.net/ At the very least,

Re: Regular expression bug?

2009-02-19 Thread Kurt Smith
On Thu, Feb 19, 2009 at 12:55 PM, Ron Garret rnospa...@flownet.com wrote: I'm trying to split a CamelCase string into its constituent components. This kind of works: re.split('[a-z][A-Z]', 'fooBarBaz') ['fo', 'a', 'az'] but it consumes the boundary characters. To fix this I tried using

Re: Newby Question for reading a file

2009-02-19 Thread Curt Hash
On Thu, Feb 19, 2009 at 12:07 PM, steven.oldner steven.old...@gmail.com wrote: On Feb 19, 12:40 pm, Mike Driscoll kyoso...@gmail.com wrote: On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I haven't found an answer. I program in ABAP, and in ABAP

Re: Newby Question for reading a file

2009-02-19 Thread Peter Otten
steven.oldner wrote: On Feb 19, 12:40 pm, Mike Driscoll kyoso...@gmail.com wrote: On Feb 19, 12:32 pm, steven.oldner steven.old...@gmail.com wrote: Simple question but I haven't found an answer.  I program in ABAP, and in ABAP you define the data structure of the file and move the file

Re: Regular expression bug?

2009-02-19 Thread andrew cooke
i wonder what fraction of people posting with bug? in their titles here actually find bugs? anyway, how about: re.findall('[A-Z]?[a-z]*', 'fooBarBaz') or re.findall('([A-Z][a-z]*|[a-z]+)', 'fooBarBaz') (you have to specify what you're matching and lookahead/back doesn't do that). andrew

  1   2   3   >