Re: You, spare time and SyntaxError

2008-07-09 Thread cokofreedom
> > just... great !-) > Thanks :) -- http://mail.python.org/mailman/listinfo/python-list

Re: error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Peter Otten
Jordan wrote: > C: > > u starts at 1050 > > u += 0xe91aaa35; > > u is now -384127409 Hm, a negative unsigned... > Python: > >    u starts at 1050 > >    u += 0xe91aaa35 > >    u is now  3910839887L Seriously, masking off the leading ones is the way to go: >>> -384127409 & 0x == 3

Re: TypeError, I know why but not how!?

2008-07-09 Thread A.T.Hofkamp
On 2008-07-10, ssecorp <[EMAIL PROTECTED]> wrote: > > def validate(placed): > student = round(random.random()*401) > if student in placed: > validate(placed) > else: > placed.append(student) > return student, placed > > def pair(incompatibles, placed): > stud

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

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, Mirko Vogt <[EMAIL PROTECTED]> wrote: > Is that behaviour common or even documented? Found nothing. Second sentence in the socket module documentation: Note: Some behavior may be platform dependent, since calls are made to the operating system socket APIs. So yes, what you found i

Re: "in"consistency?

2008-07-09 Thread Terry Reedy
castironpi wrote: On Jul 8, 2:25 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: Compare to an imaginary "set of ints" data type: a= setofints( [ 0, 1, 2 ] ) Then, the semantics of b= setofints( [ 0, 1 ] ) b in a True are consistent and predictable. Correct me if I'm wrong. If you defi

Re: Relative Package Import

2008-07-09 Thread Peter Otten
Kay Schluehr wrote: > On 8 Jul., 21:09, Peter Otten <[EMAIL PROTECTED]> wrote: >> Robert Hancock wrote: >> > mypackage/ >> > __init__.py >> > push/ >> > __init__.py >> > dest.py >> > feed/ >> >__init__py >> >

Re: error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Jordan
if after the first step (u += 0xe91aaa35) you apply this function: invert = lambda x: ~int(hex(0x - x)[0:-1],16) it returns the correct value (corrected the overflow) but there is still something wrong, still looking into it, if someone knows how to do this, feel free to comment :) -- ht

Re: variable question

2008-07-09 Thread Terry Reedy
Support Desk wrote: 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.

Re: python scalability

2008-07-09 Thread Daniel Fetchinson
>> I work on a desktop application that has been developed using python >> and GTK (see www.leapfrog3d.com). We have around 150k lines of python >> code (and 200k+ lines of C). We also have a new project manager with >> a C# background who has deep concerns about the scalability of python >> as o

Re: python scalability

2008-07-09 Thread Jake Anderson
Tim Mitchell wrote: Hi All, I work on a desktop application that has been developed using python and GTK (see www.leapfrog3d.com). We have around 150k lines of python code (and 200k+ lines of C). We also have a new project manager with a C# background who has deep concerns about the scalabi

Re: Python and decimal character entities over 128.

2008-07-09 Thread Marc 'BlackJack' Rintsch
On Wed, 09 Jul 2008 16:39:24 -0700, bsagert wrote: > Some web feeds use decimal character entities that seem to confuse > Python (or me). I guess they confuse you. Python is fine. > For example, the string "doesn't" may be coded as "doesn’t" which > should produce a right leaning apostrophe. Py

Re: Manipulating bitsets in struct

2008-07-09 Thread Marc 'BlackJack' Rintsch
On Wed, 09 Jul 2008 20:04:24 -0400, Allen wrote: > I'm using Python to do some simple network programming, and found the > struct module very useful for such things, but is there a way to easily > manipulate bitsets such as a 16 bit word being split into 4 parts like 2 > bits, 1 bit, 4 bits, an

Re: error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Jordan
I realize I did a pretty bad job of explaining the problem. The problem is the python version is returning an r that is WY to big. Here is an example run through that function in each language: C: u starts at 1050 u += 0xe91aaa35; u is now -384127409 u ^= u >> 16; u

python scalability

2008-07-09 Thread Tim Mitchell
Hi All, I work on a desktop application that has been developed using python and GTK (see www.leapfrog3d.com). We have around 150k lines of python code (and 200k+ lines of C). We also have a new project manager with a C# background who has deep concerns about the scalability of python as our

Re: error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Jordan
I was actually just going through an example to show what was happening each step of the way and noticed the overflow!!! bah, stupid tricks tricks tricks!!! The problem is def the overflow, I notice that I start to get negative numbers in the C version, which makes me think that the & 0x t

Re: Py_BuildValue for char **?

2008-07-09 Thread Martin v. Löwis
> Is there any idiomatic way of mapping char ** to Python? My recommendation is to not use Py_BuildValue. Instead, use PyList_New, and then, in a loop, PyString_FromString/PyList_SetItem. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Dan Stromberg
On Wed, 09 Jul 2008 20:56:59 -0700, Jordan wrote: > I am trying to rewrite some C source code for a poker hand evaluator in > Python. Putting aside all of the comments such as just using the C > code, or using SWIG, etc. I have been having problems with my Python > code not responding the same w

Re: sort(cmp=func)

2008-07-09 Thread David Wahler
On Wed, Jul 9, 2008 at 10:58 PM, Daniel Fetchinson <[EMAIL PROTECTED]> wrote: > > > I have a list of objects that generate code. Some > > of them depend on others being listed first, to > > satisfy dependencies of others. > > > > I wrote a cmp function something like this: > > > > def dep_cmp(ob1,

error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Jordan
I am trying to rewrite some C source code for a poker hand evaluator in Python. Putting aside all of the comments such as just using the C code, or using SWIG, etc. I have been having problems with my Python code not responding the same way as the C version. C verison: unsigned find_fast(unsign

Re: sort(cmp=func)

2008-07-09 Thread Daniel Fetchinson
> I have a list of objects that generate code. Some > of them depend on others being listed first, to > satisfy dependencies of others. > > I wrote a cmp function something like this: > > def dep_cmp(ob1, ob2): > > if ob1.name in ob2.deps: > return -1 > else: >

Re: Terminate a python script from linux shell / bash script

2008-07-09 Thread MRAB
On Jul 10, 1:25 am, Larry Bates <[EMAIL PROTECTED]> wrote: > Gros Bedo wrote: > > Hello :-) > > > I have a question about Python and Linux shell. I have a python program > > which is permanently resident in the end-user system. I'm currently > > producing a RPM package, and it works nicely. The p

Re: Python equivalent of call/cc?

2008-07-09 Thread Aahz
In article <[EMAIL PROTECTED]>, The Pythonista <[EMAIL PROTECTED]> wrote: > >Yesterday, I was hacking around a bit, trying to figure out how to >implement the semantics of call/cc in Python. Specifically, I wanted to >translate this Scheme code to equivalent Python: > > > >(define theContin

sort(cmp=func)

2008-07-09 Thread Tobiah
I have a list of objects that generate code. Some of them depend on others being listed first, to satisfy dependencies of others. I wrote a cmp function something like this: def dep_cmp(ob1, ob2): if ob1.name in ob2.deps: return -1 else:

Re: sage vs enthought for sci computing

2008-07-09 Thread Mike Hansen
On Jul 7, 3:35 pm, [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 overlap (fr

Re: Dynamic HTML from Python Script

2008-07-09 Thread Ethan Furman
Dave Parker wrote: On Jun 11, 10:43 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: Those are not /server side/ refreshes... Correct. But we weren't discussing server side refreshes. We were discussing how to make the "browser refresh automatically in the server side": Two things:

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

2008-07-09 Thread John Machin
On Jul 9, 10:06 pm, Kris Kennaway <[EMAIL PROTECTED]> wrote: > 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 t

Re: TypeError, I know why but not how!?

2008-07-09 Thread Robert Kern
ssecorp wrote: Im looking into PvsNP: http://www.claymath.org/millennium/P_vs_NP/ so I thought I'd write the program just to get a feel for it. But I run into a problem. Why does it all the sudden return None? I mean I know why the program aborts but I dont understand why the None is generated

TypeError, I know why but not how!?

2008-07-09 Thread ssecorp
Im looking into PvsNP: http://www.claymath.org/millennium/P_vs_NP/ so I thought I'd write the program just to get a feel for it. But I run into a problem. Why does it all the sudden return None? I mean I know why the program aborts but I dont understand why the None is generated all the sudden. H

Re: Determining when a file has finished copying

2008-07-09 Thread Cameron Simpson
On 09Jul2008 15:54, Ethan Furman <[EMAIL PROTECTED]> wrote: > The solution my team has used is to monitor the file size. If the file > has stopped growing for x amount of time (we use 45 seconds) the file is > done copying. Not elegant, but it works. If you know that files appear in sequence

Re: "in"consistency?

2008-07-09 Thread castironpi
On Jul 8, 2:25 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > castironpi wrote: > > Strings are not containers. > > Library Reference/Built-in Types/Sequence Types says > "Strings contain Unicode characters." > Perhaps you have a different notion of contain/container. > > I prefer 'collection' to 'co

Re: Determining when a file has finished copying

2008-07-09 Thread Larry Bates
keith wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ethan Furman wrote: writeson wrote: 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 writ

Re: Determining when a file has finished copying

2008-07-09 Thread keith
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ethan Furman wrote: > writeson wrote: >> 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

Re: Manipulating bitsets in struct

2008-07-09 Thread Larry Bates
Allen wrote: I'm using Python to do some simple network programming, and found the struct module very useful for such things, but is there a way to easily manipulate bitsets such as a 16 bit word being split into 4 parts like 2 bits, 1 bit, 4 bits, and 9 bits? Perhaps something like: struct.

Re: Terminate a python script from linux shell / bash script

2008-07-09 Thread Larry Bates
Gros Bedo wrote: Hello :-) I have a question about Python and Linux shell. I have a python program which is permanently resident in the end-user system. I'm currently producing a RPM package, and it works nicely. The problem is that when I uninstall it, my program keeps running in the backgro

Re: Python equivalent of call/cc?

2008-07-09 Thread Larry Bates
The Pythonista wrote: Yesterday, I was hacking around a bit, trying to figure out how to implement the semantics of call/cc in Python. Specifically, I wanted to translate this Scheme code to equivalent Python: (define theContinuation #f) (define (test) (let ((i 0)) (call/cc

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Daniel Fetchinson
>> 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 Python's object > model is fundamentally broken and crappy

Manipulating bitsets in struct

2008-07-09 Thread Allen
I'm using Python to do some simple network programming, and found the struct module very useful for such things, but is there a way to easily manipulate bitsets such as a 16 bit word being split into 4 parts like 2 bits, 1 bit, 4 bits, and 9 bits? Perhaps something like: struct.pack('!h(2:1:4

Python and decimal character entities over 128.

2008-07-09 Thread bsagert
Some web feeds use decimal character entities that seem to confuse Python (or me). For example, the string "doesn't" may be coded as "doesn’t" which should produce a right leaning apostrophe. Python hates decimal entities beyond 128 so it chokes unless you do something like string.encode('utf-8').

redirecting output of process to a file using subprocess.Popen()

2008-07-09 Thread rparimi
I am trying to redirect stderr of a process to a temporary file and then read back the contents of the file, all in the same python script. As a simple exercise, I launched /bin/ls but this doesn't work: #!/usr/bin/python import subprocess as proc import tempfile name = tempfile.NamedTemporaryFile

Py_BuildValue for char **?

2008-07-09 Thread js
Hi, I'm writing a wrapper module of C API. To make a C struct data avaiable to Python, I need to map C struct into a PyObject. I'm thinking that I use a tuple or dict to represent the struct but a problem is one of the members of the struct is char **, which is not supported by Py_BuildValue. Is t

RE: Freesoftware for auto/intelligent code completing in Python

2008-07-09 Thread Gros Bedo
Hello, Ali I totally support you, neither I couldn't find any really working code completion for python in a free software, and it's really a mess, at least on Linux. On Windows, there is PyScripter (http://pyscripter.googlepages.com/), but it is based on Delphi, and as such it's not portable.

Terminate a python script from linux shell / bash script

2008-07-09 Thread Gros Bedo
Hello :-) I have a question about Python and Linux shell. I have a python program which is permanently resident in the end-user system. I'm currently producing a RPM package, and it works nicely. The problem is that when I uninstall it, my program keeps running in the background, even if the f

Re: Determining when a file has finished copying

2008-07-09 Thread Ethan Furman
writeson wrote: 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 wa

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

2008-07-09 Thread [EMAIL PROTECTED]
On Jul 9, 7:08 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > 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

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

2008-07-09 Thread [EMAIL PROTECTED]
On Jul 9, 8:46 am, Dan Stromberg <[EMAIL PROTECTED]> 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 o

Python equivalent of call/cc?

2008-07-09 Thread The Pythonista
Yesterday, I was hacking around a bit, trying to figure out how to implement the semantics of call/cc in Python. Specifically, I wanted to translate this Scheme code to equivalent Python: (define theContinuation #f) (define (test) (let ((i 0)) (call/cc (lambda (k) (set! theCont

Retrieving BSTR * from a DLL

2008-07-09 Thread mzdude
I need to interface with a windows DLL that has the following signature extern "C" void Foo( BSTR in, BSTR *out ) Code so far >>> from ctypes import * >>> import comtypes >>> LPBSTR = POINTER(comtypes.BSTR) >>> >>> hdl = windll.MyDll.Foo >>> hdl.rettype = None >>> hdl.argtypes = [comtypes.BSTR,

Re: Determining when a file has finished copying

2008-07-09 Thread Daniel Mahoney
> 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

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

2008-07-09 Thread Duncan Booth
Michiel Overtoom <[EMAIL PROTECTED]> wrote: > 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 in > Python is below. I wonder if there is

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

2008-07-09 Thread egbert
On Wed, Jul 09, 2008 at 10:25:33PM +0200, Michiel Overtoom wrote: > Formatting a sequence of items such that they are separated by > commas, except the last item, which is separated by the word 'and'. > > For example: > > Three friends have a dinner: Anne, Bob and Chris row = ["Anne","Bob","Chri

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

2008-07-09 Thread Larry Bates
Michiel Overtoom wrote: 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 cleare

Re: Relative Package Import

2008-07-09 Thread Kay Schluehr
On 8 Jul., 21:09, Peter Otten <[EMAIL PROTECTED]> wrote: > Robert Hancock wrote: > > mypackage/ > > __init__.py > > push/ > > __init__.py > > dest.py > > feed/ > >__init__py > > subject.py

Re: Determining when a file has finished copying

2008-07-09 Thread Larry Bates
writeson wrote: 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 wa

Re: You, spare time and SyntaxError

2008-07-09 Thread [EMAIL PROTECTED]
On 9 juil, 16:56, [EMAIL PROTECTED] wrote: > 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 >

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

2008-07-09 Thread Larry Bates
[EMAIL PROTECTED] wrote: 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

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

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: 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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: 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,

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

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

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

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

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: 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

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: 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: 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

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: "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

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: 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: 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: 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: 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

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: 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

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: 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

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

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

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() > >

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: 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

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: 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

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

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: 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() > >

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

  1   2   >