[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
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
>
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
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
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
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
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
> 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
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,
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
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
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
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
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
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.
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
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
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').
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
>> 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
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
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
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.
-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
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
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
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
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
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
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
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:
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
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:
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
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
> 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:
>
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
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,
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
> 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
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
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
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
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
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
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
>> 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
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.
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
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
>> >
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
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
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
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
>
> just... great !-)
>
Thanks :)
--
http://mail.python.org/mailman/listinfo/python-list
101 - 155 of 155 matches
Mail list logo