Re: Cross Compiler for Python?

2008-07-09 Thread Hendrik van Rooyen
"norseman" wrote: 8< - > dreaded Yep! I know the feeling. Got lots of those T-Shirts. ;) > > > I re-read your original post. I got the feeling the eBox is running a > stripped down Linux. Is that so? If it is, then: Correct

Regular Expressions Quick Question

2008-07-09 Thread Lamonte Harris
Alright, basically I have a list of words in a file and I load each word from each line into the array. Then basically the question is how do I check if the input word matches multiple words in the list. Say someone input "test", how could I check if that word matches these list of words: test t

Re: Newbie question

2008-07-09 Thread |e0
So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote: > I think the win32 module is only for windows. > -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expressions Quick Question

2008-07-09 Thread Rajanikanth Jammalamadaka
hi! Try this: >>> lis=['t','tes','test','testing'] >>> [elem for elem in lis if re.compile("^te").search(elem)] ['tes', 'test', 'testing'] Cheers, Raj On Wed, Jul 9, 2008 at 12:13 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote: > Alright, basically I have a list of words in a file and I load eac

Re: ActiveState Code: the new Python Cookbook site

2008-07-09 Thread Stef Mientki
hi Mike, nice job, I just took a quick look, Trent Mick wrote: The Python Cookbook is by far the most popular of the ASPN Cookbooks, so I wanted to get the Python community's feedback on the new site. What do you think? What works? What doesn't? I'll try to answer feedback on python-list o

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread John Machin
On Jul 9, 2:01 am, Kris Kennaway <[EMAIL PROTECTED]> wrote: > samwyse wrote: > > On Jul 4, 6:43 am, Henning_Thornblad <[EMAIL PROTECTED]> > > wrote: > >> What can be the cause of the large difference between re.search and > >> grep? > > >> While doing a simple grep: > >> grep '[^ "=]*/' input      

delete lines

2008-07-09 Thread antar2
I am new in python and I have the following problem: Suppose I have a list with words of which I want to remove each time the words in the lines below item1 and above item2: item1 a b item2 c d item3 e f item4 g h item1 i j item2 k l item3 m n item4 o p I did not find out how to do this: Part o

Re: Newbie question

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, |e0 <[EMAIL PROTECTED]> wrote: > So, i can't use wmi module on linux? > > On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote: >> I think the win32 module is only for windows. >> Welcome to the world outside MS. Many python modules don't actually do anything th

Re: Regular Expressions Quick Question

2008-07-09 Thread Bruno Desthuilliers
Rajanikanth Jammalamadaka a écrit : (top-post corrected - Please, Rajanikanth, learn to trim"e properly, and by all means avoid top-posting) On Wed, Jul 9, 2008 at 12:13 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote: Alright, basically I have a list of words in a file and I load each word from

Re: Newbie question

2008-07-09 Thread Tim Golden
A.T.Hofkamp wrote: On 2008-07-09, |e0 <[EMAIL PROTECTED]> wrote: So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote: I think the win32 module is only for windows. Welcome to the world outside MS. Many python modules don't actually

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Luis Zarrabeitia
This could work: l = [0,0,1,2,1,0,0] indexes, values = zip(*((index,value) for index,value in enumerate(l) if value != 0)) But I guess it would be a little less cryptic (and maybe a lot more efficient) if there were an unzip function instead of using the zip(*sequence) trick. I think a more rea

Re: delete lines

2008-07-09 Thread Peter Otten
antar2 wrote: > I am new in python and I have the following problem: > > Suppose I have a list with words of which I want to remove each time > the words in the lines below item1 and above item2: > f = re.compile("item\[1\]\:") > g = re.compile("item\[2\]\:") > for i, line in enumerate(list1): >

Opening Unicode files

2008-07-09 Thread Noorhan Abbas
Hello, I wonder if you don't mind helping me out in this problem. I have been developing a tool in python that opens some unicode files, reading them and processing the data. It is working fine. When I started to write a cgi module that does the same thing for google appengine(actually it is usi

Manipulating sys.path

2008-07-09 Thread Thomas
Hi all, I want to manipulate sys.path outside of PYTHONPATH (environment) and sys.path.append() (programmatically). A bit of background: We're maintaining a small application that includes a couple of Python scripts. Over time, a decent amount of code has been forked into modules, so the ove

Re: a simple 'for' question

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 00:00 -0400, Ben Keshet wrote: > oops, my mistake, actually it didn't work... > when I tried: > for x in folders: > print x # print the current folder > filename='Folder/%s/myfile.txt' %x > f=open(filename,'r') > > it says: IOError: [Errno 2] No such file or

start reading from certain line

2008-07-09 Thread antar2
I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' The weather is nice Item 1 We will go to the seaside ... Only the li

Re: (silly?) speed comparisons

2008-07-09 Thread mk
Rajanikanth Jammalamadaka wrote: Try using a list instead of a vector for the C++ version. Well, it's even slower: $ time slice4 real0m4.500s user0m0.015s sys 0m0.015s Time of execution of vector version (using reference to a vector): $ time slice2 real0m2.420s user0m0

Re: start reading from certain line

2008-07-09 Thread Diez B. Roggisch
antar2 wrote: > I am a starter in python and would like to write a program that reads > lines starting with a line that contains a certain word. > For example the program starts reading the program when a line is > encountered that contains 'item 1' > > > The weather is nice > Item 1 > We will g

mock with inheritance

2008-07-09 Thread lidiriel
Hello, i would like use a mock object for testing one class and its methods: Here my class : class Foo(Component): def __init__(self): self._db = self.env.get_db() def foomethod(self, arg): . But i don't know how to mock the class Component. Note that Component provide

Re: start reading from certain line

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: > I am a starter in python and would like to write a program that reads > lines starting with a line that contains a certain word. > For example the program starts reading the program when a line is > encountered that contains 'item 1' > > > The w

Re: start reading from certain line

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: > I am a starter in python and would like to write a program that reads > lines starting with a line that contains a certain word. > For example the program starts reading the program when a line is > encountered that contains 'item 1' > > > The we

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread cokofreedom
> > My question is: did something about the way the special method names are > implemented change for new-style classes? > >>> class old: pass >>> class new(object): pass >>> testone = old() >>> testone.__call__ = lambda : 33 >>> testone() 33 >>> testtwo = new() >>> testtwo.__cal

Re: start reading from certain line

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, antar2 <[EMAIL PROTECTED]> wrote: > I am a starter in python and would like to write a program that reads > lines starting with a line that contains a certain word. > For example the program starts reading the program when a line is > encountered that contains 'item 1' > > > The weat

Re: a simple 'for' question

2008-07-09 Thread cokofreedom
On Jul 9, 2:08 am, Ben Keshet <[EMAIL PROTECTED]> wrote: > Hi fans, > > I want to use a 'for' iteration to manipulate files in a set of folders, > something like: > > folders= ['1A28','1A6W','56Y7'] > for x in folders: > print x # print the current folder > f = open('my/path/way/x/my_fi

Re: mock with inheritance

2008-07-09 Thread Ben Finney
lidiriel <[EMAIL PROTECTED]> writes: > But i don't know how to mock the class Component. Note that Component > provide the attribut env. I prefer to use the MiniMock framework http://cheeseshop.python.org/pypi/MiniMock>. You don't need to specify what interface the mock object has. Its Mock obje

Doubts about how implementing asynchronous timeouts through a heap

2008-07-09 Thread Giampaolo Rodola'
Hi, I'm trying to implement an asynchronous scheduler for asyncore to call functions at a later time without blocking the main loop. The logic behind it consists in: - adding the scheduled functions into a heapified list - calling a "scheduler" function at every loop which checks the scheduled fun

Re: a simple 'for' question

2008-07-09 Thread Ben Keshet
it didn't help. it reads the pathway "as is" (see errors for both tries). It looks like it had the write pathway the first time, but could not find it because it searched in the path/way instead of in the path\way. thanks for trying. folders= ['1','2','3'] for x in folders: print x #

Re: GUI Programming by hand not code with Python Code

2008-07-09 Thread Nicola Musatti
On Jul 8, 10:09 pm, sturlamolden <[EMAIL PROTECTED]> wrote: [...] > I use wxFormBuilder with wxPython. Works like a charm. Design the GUI > graphically, export it like a wx XML resource (.xrc). All you nedd to > code in Python is the event handlers and the code to bind/hook the > events. > > http:/

Re: How to make python scripts .py executable, not bring up editor

2008-07-09 Thread Gerry
And if you've gotten this far, why not take the next step: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/476204 and just type tryme (as opposed to tryme.py) Gerry -- http://mail.python.org/mailman/listinfo/python-list

Re: a simple 'for' question

2008-07-09 Thread Bruno Desthuilliers
Tim Cook a écrit : On Wed, 2008-07-09 at 00:00 -0400, Ben Keshet wrote: oops, my mistake, actually it didn't work... when I tried: for x in folders: print x # print the current folder filename='Folder/%s/myfile.txt' %x f=open(filename,'r') it says: IOError: [Errno 2] No such fil

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread Kris Kennaway
John Machin wrote: Hmm, unfortunately it's still orders of magnitude slower than grep in my own application that involves matching lots of strings and regexps against large files (I killed it after 400 seconds, compared to 1.5 for grep), and that's leaving aside the much longer compilation time

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread Jeroen Ruigrok van der Werven
-On [20080709 14:08], Kris Kennaway ([EMAIL PROTECTED]) wrote: >It's compiler/build output. Sounds like the FreeBSD ports build cluster. :) Kris, have you tried a PGO build of Python with your specific usage? I cannot guarantee it will significantly speed things up though. Also, a whi

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread Kris Kennaway
Jeroen Ruigrok van der Werven wrote: -On [20080709 14:08], Kris Kennaway ([EMAIL PROTECTED]) wrote: It's compiler/build output. Sounds like the FreeBSD ports build cluster. :) Yes indeed! Kris, have you tried a PGO build of Python with your specific usage? I cannot guarantee it

Re: (silly?) speed comparisons

2008-07-09 Thread Maric Michaud
Le Wednesday 09 July 2008 12:35:10 mk, vous avez écrit : > vector move_slice(vector& vec, int start, int stop, int > dest) I guess the point is to make a vector of referene to string if you don't want to copy string objects all around but just a word for an address each time. The signature shou

Re: Newbie question

2008-07-09 Thread |e0
I did not mean to use WMI on linux, but query win machines *from* linux. Thank you for your clarifications - Leonardo On Wed, Jul 9, 2008 at 11:04 AM, A.T.Hofkamp <[EMAIL PROTECTED]> wrote: > Welcome to the world outside MS. > > Many python modules don't actually do anything than passing on calls

Re: Newbie question

2008-07-09 Thread Tim Golden
|e0 wrote: I did not mean to use WMI on linux, but query win machines *from* linux. Thank you for your clarifications In principle you ought to be able to use some kind of DCOM bridge (since WMI access if via COM/DCOM). I've no idea if anyone's attempted this or even if all the pieces are in pl

Re: Newbie question

2008-07-09 Thread Diez B. Roggisch
|e0 wrote: > I did not mean to use WMI on linux, but query win machines *from* linux. What do you mean by "query"? Using the WMI module? No. It's Windows only. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Andrii V. Mishkovskyi
2008/7/9 Benjamin Goudey <[EMAIL PROTECTED]>: > I have a very large list of integers representing data needed for a > histogram that I'm going to plot using pylab. However, most of these > values (85%-95%) are zero and I would like to remove them to reduce > the amount of memory I'm using and save

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Chris
On Jul 9, 7:48 am, "Rajanikanth Jammalamadaka" <[EMAIL PROTECTED]> wrote: > Try this: > > >>> li=[0,0,1,2,1,0,0] > >>> li > > [0, 0, 1, 2, 1, 0, 0]>>> [i for i in range(len(li)) if li[i] != 0] > > [2, 3, 4] > > Cheers, > > Raj > > > > On Tue, Jul 8, 2008 at 10:26 PM, Benjamin Goudey <[EMAIL PROTECT

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Chris
On Jul 9, 7:48 am, "Rajanikanth Jammalamadaka" <[EMAIL PROTECTED]> wrote: > Try this: > > >>> li=[0,0,1,2,1,0,0] > >>> li > > [0, 0, 1, 2, 1, 0, 0]>>> [i for i in range(len(li)) if li[i] != 0] > > [2, 3, 4] > > Cheers, > > Raj > > > > On Tue, Jul 8, 2008 at 10:26 PM, Benjamin Goudey <[EMAIL PROTECT

Python / Windows process control

2008-07-09 Thread Salim Fadhley
Does anybody know of a python module which can do process management on Windows? The sort of thing that we might usually do with taskmgr.exe or process explorer? For example: * Kill a process by ID * Find out which process ID is locking an object in the filesystem * Find out all the IDs of a part

Doubts about how implementing asynchronous timeouts through a heap

2008-07-09 Thread Giampaolo Rodola'
Hi, I'm trying to implement an asynchronous scheduler for asyncore to call functions at a later time without blocking the main loop. The logic behind it consists in: - adding the scheduled functions into a heapified list - calling a "scheduler" function at every loop which checks the scheduled fun

Allow tab completion when inputing filepath?

2008-07-09 Thread Keith Hughitt
Hi all, I've been looking around on the web for a way to do this, but so far have not come across anything for this particular application. I have found some ways to enable tab completion for program-related commands, but not for system filepaths. This would be nice to have when prompting the user

Re: Allow tab completion when inputing filepath?

2008-07-09 Thread Tim Golden
Keith Hughitt wrote: I've been looking around on the web for a way to do this, but so far have not come across anything for this particular application. I have found some ways to enable tab completion for program-related commands, but not for system filepaths. This would be nice to have when prom

Re: Relative Package Import

2008-07-09 Thread Thomas
Robert Hancock wrote: mypackage/ __init__.py push/ __init__.py dest.py feed/ __init__py subject.py In subject.py I have from ..push import dest There is no such thing as relative p

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Paul McGuire
On Jul 9, 12:26 am, Benjamin Goudey <[EMAIL PROTECTED]> wrote: > I have a very large list of integers representing data needed for a > histogram that I'm going to plot using pylab. However, most of these > values (85%-95%) are zero and I would like to remove them to reduce > the amount of memory I'

FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Phillip B Oldham
I'm wondering whether anyone can offer suggestions on FOSS projects/ apps which exhibit solid OO principles, clean code, good inline documentation, and sound design principles? I'm devoting some time to reviewing other people's code to advance my skills. Its good to review bad code (of which I hav

Re: Relative Package Import

2008-07-09 Thread Peter Otten
Thomas wrote: > Robert Hancock wrote: >> mypackage/ >> __init__.py >> push/ >> __init__.py >> dest.py >> feed/ >>__init__py >> subject.py >> >> In subject.py I have >> from ..push im

Re: (silly?) speed comparisons

2008-07-09 Thread mk
Maric Michaud wrote: Le Wednesday 09 July 2008 12:35:10 mk, vous avez écrit : vector move_slice(vector& vec, int start, int stop, int dest) I guess the point is to make a vector of referene to string if you don't want to copy string objects all around but just a word for an address each time

You, spare time and SyntaxError

2008-07-09 Thread cokofreedom
def ine(you): yourself = "what?" go = list("something"), list("anything") be = "something" please = be, yourself yourself = "great" for good in yourself: if you is good: good in you please.add(more, good) else: def inition(lacks, c

Re: (silly?) speed comparisons

2008-07-09 Thread mk
P.S. Java 1.6 rocks - I wrote equivalent version using ArrayList and it executed in 0.7s. -- http://mail.python.org/mailman/listinfo/python-list

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 07:38 -0700, Phillip B Oldham wrote: > I'm wondering whether anyone can offer suggestions on FOSS projects/ > apps which exhibit solid OO principles, clean code, good inline > documentation, and sound design principles? > > I'm devoting some time to reviewing other people's

Re: numeric emulation and __pos__

2008-07-09 Thread samwyse
On Jul 8, 12:34 pm, Ethan Furman <[EMAIL PROTECTED]> wrote: > Anybody have an example of when the unary + actually does something? > Besides the below Decimal example.  I'm curious under what circumstances > it would be useful for more than just completeness (although > completeness for it's own s

Re: Logging to zero or more destinations

2008-07-09 Thread samwyse
On Jul 8, 3:01 pm, Rob Wolfe <[EMAIL PROTECTED]> wrote: > samwyse <[EMAIL PROTECTED]> writes: > > P.S.  I tried researching this further by myself, but the logging > > module doesn't come with source (apparently it's written in C?) and I > > don't have the time to find and download the source to m

Re: Boost Python - C++ class' private static data blown away before accessing in Python?

2008-07-09 Thread Stodge
Thanks. Maybe it's a DLL boundary issue? I'll look into this too. On Jul 5, 11:14 pm, Giuseppe Ottaviano <[EMAIL PROTECTED]> wrote: > > In Python, I retrive an Entity from the EntityList: > > > elist = EntityList() > > elist.append(Entity()) > > elist.append(Entity()) > > > entity = elist.get_at(0

Re: Opening Unicode files

2008-07-09 Thread Gary Herron
Noorhan Abbas wrote: Hello, I wonder if you don't mind helping me out in this problem. I have been developing a tool in python that opens some unicode files, reading them and processing the data. It is working fine. When I started to write a cgi module that does the same thing for google appe

Re: Boost Python - C++ class' private static data blown away before accessing in Python?

2008-07-09 Thread Stodge
I wonder if it's a DLL boundary problem. On Jul 5, 11:14 pm, Giuseppe Ottaviano <[EMAIL PROTECTED]> wrote: > > In Python, I retrive an Entity from the EntityList: > > > elist = EntityList() > > elist.append(Entity()) > > elist.append(Entity()) > > > entity = elist.get_at(0) > > > entity.foo() > >

Anyone happen to have optimization hints for this loop?

2008-07-09 Thread dp_pearce
I have some code that takes data from an Access database and processes it into text files for another application. At the moment, I am using a number of loops that are pretty slow. I am not a hugely experienced python user so I would like to know if I am doing anything particularly wrong or that ca

Re: Newbie question

2008-07-09 Thread Mike Driscoll
On Jul 9, 2:19 am, |e0 <[EMAIL PROTECTED]> wrote: > So, i can't use wmi module on linux? > > On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote: > > I think the win32 module is only for windows. WMI is a Windows thing. It stands for "Windows Management Instrumentation". So it

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread Diez B. Roggisch
dp_pearce wrote: > I have some code that takes data from an Access database and processes > it into text files for another application. At the moment, I am using > a number of loops that are pretty slow. I am not a hugely experienced > python user so I would like to know if I am doing anything > p

Determining when a file has finished copying

2008-07-09 Thread writeson
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to process the file. The appearance of the command file triggers the device to grab the original file. My proble

Re: numeric emulation and __pos__

2008-07-09 Thread Sion Arrowsmith
Ethan Furman <[EMAIL PROTECTED]> wrote: >Anybody have an example of when the unary + actually does something? I've seen it (jokingly) used to implement a prefix increment operator. I'm not going to repeat the details in case somebody decides it's serious code. -- \S -- [EMAIL PROTECTED] -- http

Re: Regular Expressions Quick Question

2008-07-09 Thread Paul McGuire
On Jul 9, 2:24 am, "Rajanikanth Jammalamadaka" <[EMAIL PROTECTED]> wrote: > hi! > > Try this: > > >>> lis=['t','tes','test','testing'] > >>> [elem for elem in lis if re.compile("^te").search(elem)] > > ['tes', 'test', 'testing'] > > Cheers, > > Raj > > > > > > On Wed, Jul 9, 2008 at 12:13 AM, Lamon

Re: Boost Python - C++ class' private static data blown away before accessing in Python?

2008-07-09 Thread Stodge
Could it be a boundary problem? The static data is initialised by the application. The problem arises when the python module tries to access it. On Jul 5, 11:14 pm, Giuseppe Ottaviano <[EMAIL PROTECTED]> wrote: > > In Python, I retrive an Entity from the EntityList: > > > elist = EntityList() > >

trouble building Python 2.5.1 on solaris 10

2008-07-09 Thread mg
When make gets to the _ctypes section, I am getting the following in my output: building '_ctypes' extension creating build/temp.solaris-2.10-i86pc-2.5/home/ecuser/Python-2.5.1/ Modules/_ctypes creating build/temp.solaris-2.10-i86pc-2.5/home/ecuser/Python-2.5.1/ Modules/_ctypes/libffi creating bui

Anyone happen to have optimization hints for this loop?

2008-07-09 Thread dp_pearce
I have some code that takes data from an Access database and processes it into text files for another application. At the moment, I am using a number of loops that are pretty slow. I am not a hugely experienced python user so I would like to know if I am doing anything particularly wrong or that ca

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Larry Bates
Phillip B Oldham wrote: I'm wondering whether anyone can offer suggestions on FOSS projects/ apps which exhibit solid OO principles, clean code, good inline documentation, and sound design principles? I'm devoting some time to reviewing other people's code to advance my skills. Its good to revie

Re: Determining when a file has finished copying

2008-07-09 Thread Manuel Vazquez Acosta
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This seems a synchronization problem. A scenario description could clear things up so we can help: Program W (The workflow) copies file F to directory B Program D (the dog) polls directory B to find is there's any new file F In this scenario, program

Re: Determining when a file has finished copying

2008-07-09 Thread Larry Bates
writeson wrote: Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to process the file. The appearance of the command file triggers the device to grab the origin

Openine unicode files

2008-07-09 Thread Noorhan Abbas
Hello, I wonder if someone can advise me on how to open unicode utf-8 files without using the codecs library . I am trying to use the codecs.open() from within Google Appengine but it is not working.   Thank you very much in advance, Nora _

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread writeson
On Jul 9, 12:04 pm, dp_pearce <[EMAIL PROTECTED]> wrote: > I have some code that takes data from an Access database and processes > it into text files for another application. At the moment, I am using > a number of loops that are pretty slow. I am not a hugely experienced > python user so I would

Re: start reading from certain line

2008-07-09 Thread norseman
Tim Cook wrote: On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' T

Re: Determining when a file has finished copying

2008-07-09 Thread norseman
Also available: pgm-W copies/creates-fills whatever B/dummy when done, pgm-W renames B/dummy to B/F pgm-D only scouts for B/F and does it thing when found Steve [EMAIL PROTECTED] Manuel Vazquez Acosta wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This seems a synchronization pro

Re: how to remove oldest files up to a limit efficiently

2008-07-09 Thread Terry Reedy
Dan Stromberg wrote: On Tue, 08 Jul 2008 15:18:23 -0700, [EMAIL PROTECTED] wrote: I need to mantain a filesystem where I'll keep only the most recently used (MRU) files; least recently used ones (LRU) have to be removed to leave space for newer ones. The filesystem in question is a clustered

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread Casey
On Jul 9, 12:04 pm, dp_pearce <[EMAIL PROTECTED]> wrote: > I have some code that takes data from an Access database and processes > it into text files for another application. At the moment, I am using > a number of loops that are pretty slow. I am not a hugely experienced > python user so I would

Re: "in"consistency?

2008-07-09 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Terry Reedy <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > In article <[EMAIL PROTECTED]>, > > Terry Reedy <[EMAIL PROTECTED]> wrote: > > >>> Is there a reason for the inconsistency? I would > >>> have thought "in" would check for elements of a > >>> se

User-defined exception: "global name 'TestRunError' is not defined"

2008-07-09 Thread jmike
I'm using some legacy code that has a user-defined exception in it. The top level program includes this line from TestRunError import * It also imports several other modules. These other modules do not explicitly import TestRunError. TestRunError is raised in various places throughout the modu

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread Terry Reedy
Diez B. Roggisch wrote: dp_pearce wrote: count = 0 dmntString = "" for z in range(0, Z): for y in range(0, Y): for x in range(0, X): fraction = domainVa[count] dmntString += " " dmntString += fraction Minor point, just construct " "+doma

Re: sage vs enthought for sci computing

2008-07-09 Thread Ken Starks
sturlamolden wrote: On 7 Jul, 22:35, [EMAIL PROTECTED] wrote: Hello, I have recently become interested in using python for scientific computing, and came across both sage and enthought. I am curious if anyone can tell me what the differences are between the two, since there seems to be a lot of

Re: Openine unicode files

2008-07-09 Thread Terry Reedy
Noorhan Abbas wrote: Hello, I wonder if someone can advise me on how to open unicode utf-8 files without using the codecs library . I am trying to use the codecs.open() from within Google Appengine but it is not working. When posting about something 'not working', post at least a line of

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread samwyse
On Jul 8, 4:56 pm, Joseph Barillari <[EMAIL PROTECTED]> wrote: > My question is: did something about the way the special method names are > implemented change for new-style classes? Just off the top of my head, I'd guess that it's due to classes already having a default __call__ method, used when

socket-module: different behaviour on windows / unix when a timeout is set

2008-07-09 Thread Mirko Vogt
Hey, it seems that the socket-module behaves differently on unix / windows when a timeout is set. Here an example: # test.py import socket sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) print 'trying to connect...' sock.connect(('127.0.0.1',)) print 'connected!' # executed on windo

Re: Determining when a file has finished copying

2008-07-09 Thread writeson
Guys, Thanks for your replies, they are helpful. I should have included in my initial question that I don't have as much control over the program that writes (pgm-W) as I'd like. Otherwise, the write to a different filename and then rename solution would work great. There's no way to tell from the

Re: Boost Python - C++ class' private static data blown away before accessing in Python?

2008-07-09 Thread Stodge
Oops - I didn't see my post so I thought something had gone wrong and reposted. Apologies for the multiple posts. On Jul 9, 11:57 am, Stodge <[EMAIL PROTECTED]> wrote: > Could it be a boundary problem? The static data is initialised by the > application. The problem arises when the python module t

About Google App Engine

2008-07-09 Thread Francisco Perez
Hello every body: Recently the Google boy's announce their last toy: Google App Engine, a really great idea. Although the GAE site have documentations and guides, i think it not covers the some of the best practices when we really build a web site. I mean layers, design patterns, etc. In the link b

formatting list -> comma separated

2008-07-09 Thread Robert
given d: d = ["soep", "reeds", "ook"] I want it to print like soep, reeds, ook I've come up with : print ("%s"+", %s"*(len(d)-1)) % tuple(d) but this fails for d = [] any (pythonic) options for this? Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread samwyse
On Jul 8, 11:01 am, Kris Kennaway <[EMAIL PROTECTED]> wrote: > samwyse wrote: > > You might want to look at Plex. > >http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex/ > > > "Another advantage of Plex is that it compiles all of the regular > > expressions into a single DFA. Once that's done,

Re: formatting list -> comma separated

2008-07-09 Thread Jerry Hill
On Wed, Jul 9, 2008 at 3:23 PM, Robert <[EMAIL PROTECTED]> wrote: > given d: > d = ["soep", "reeds", "ook"] > > I want it to print like > soep, reeds, ook use the join() method of strings, like this: >>> d = ["soep", "reeds", "ook"] >>> ', '.join(d) 'soep, reeds, ook' >>> d = [] >>> ', '.join(d) '

Re: formatting list -> comma separated

2008-07-09 Thread Paul Hankin
On Jul 9, 8:23 pm, "Robert" <[EMAIL PROTECTED]> wrote: > given d: > > d = ["soep", "reeds", "ook"] > > I want it to print like > > soep, reeds, ook > > I've come up with : > > print ("%s"+", %s"*(len(d)-1)) % tuple(d) > > but this fails for d = [] > > any (pythonic) options for this? print ', '.jo

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread Terry Reedy
samwyse wrote: On Jul 8, 4:56 pm, Joseph Barillari <[EMAIL PROTECTED]> wrote: My question is: did something about the way the special method names are implemented change for new-style classes? I believe the difference is that for new-style classes, when special methods are called 'behind t

variable question

2008-07-09 Thread Support Desk
I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do stuff with variable. But the variable assignment doesn't survive outside the if statement. Is there any better w

Re: a simple 'for' question

2008-07-09 Thread Ethan Furman
Ben Keshet wrote: it didn't help. it reads the pathway "as is" (see errors for both tries). It looks like it had the write pathway the first time, but could not find it because it searched in the path/way instead of in the path\way. thanks for trying. The form of slash ('\' vs '/') is irre

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread Kris Kennaway
samwyse wrote: On Jul 8, 11:01 am, Kris Kennaway <[EMAIL PROTECTED]> wrote: samwyse wrote: You might want to look at Plex. http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex/ "Another advantage of Plex is that it compiles all of the regular expressions into a single DFA. Once that's done

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread Paul Hankin
On Jul 9, 5:04 pm, dp_pearce <[EMAIL PROTECTED]> wrote: > count = 0 > dmntString = "" > for z in range(0, Z): >     for y in range(0, Y): >         for x in range(0, X): >             fraction = domainVa[count] >             dmntString += "  " >             dmntString += fraction >             coun

Re: Allow tab completion when inputing filepath?

2008-07-09 Thread Keith Hughitt
On Jul 9, 10:18 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Keith Hughitt wrote: > > I've been looking around on the web for a way to do this, but so far > > have not come across anything for this particular application. I have > > found some ways to enable tab completion for program-related comman

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Rob Wolfe
Phillip B Oldham <[EMAIL PROTECTED]> writes: > I'm wondering whether anyone can offer suggestions on FOSS projects/ > apps which exhibit solid OO principles, clean code, good inline > documentation, and sound design principles? > > I'm devoting some time to reviewing other people's code to advance

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread [EMAIL PROTECTED]
On 9 juil, 18:04, dp_pearce <[EMAIL PROTECTED]> wrote: > I have some code that takes data from an Access database and processes > it into text files for another application. At the moment, I am using > a number of loops that are pretty slow. I am not a hugely experienced > python user so I would li

Re: formatting list -> comma separated (slightly different)

2008-07-09 Thread Michiel Overtoom
Paul & Robert wrote... > d = ["soep", "reeds", "ook"] >print ', '.join(d) > soep, reeds, ook I occasionally have a need for printing lists of items too, but in the form: "Butter, Cheese, Nuts and Bolts". The last separator is the word 'and' instead of the comma. The clearest I could come up with

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread [EMAIL PROTECTED]
On 9 juil, 16:38, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > I'm wondering whether anyone can offer suggestions on FOSS projects/ > apps which exhibit solid OO principles, clean code, good inline > documentation, and sound design principles? This is somewhat subjective... Some would say that Py

Re: variable question

2008-07-09 Thread Russell Blau
"Support Desk" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am trying to assign a variable using an if / else statement like so: > If condition1: > Variable = something > If condition2: > Variable = something else > Do stuff with variable. > > But the v

  1   2   >