Re: Segmentation Fault

2006-08-28 Thread thomas . samson
"Simon Forman" <[EMAIL PROTECTED]> writes:

> pycraze wrote:
>> I would like to ask a question. How do one handle the exception due to
>> Segmentation fault due to Python ?  Our bit operations and arithmetic
>> manipulations are written in C and to some of our testcases we
>> experiance Segmentation fault from the python libraries.
>>
>> If i know how to handle the exception for Segmentation fault , it will
>> help me complete the run on any testcase , even if i experiance Seg
>> Fault due to any one or many functions in my testcase.
>
> AFAIK, seg fault kills your program dead.  There's no exception to
> handle.  If you're getting seg faults from the python standard library,
> that's a pretty serious thing, way more serious than just not-passed
> testcases.

Segfault handling is platform-dependant... So, at least on unix-like
platform, you can use the signal module to detect segfault:

import signal

def handler(signum, frame):
print 'Segfault detected'
    # you may use the stack frame here to help debugging

signal.signal(signal.SIGSEGV, handler)

-- 
Thomas SAMSON
"You're very sure of your facts, " he said at last, "I
couldn't trust the thinking of a man who takes the Universe
- if there is one - for granted. "
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: genetic algorithms package for python ?

2006-08-31 Thread Thomas Samson
Xiao Jianfeng <[EMAIL PROTECTED]> writes:

> Hi all,
>
> I am looking for a genetic algorithms package for Python.
>
> I have googled the web before posting and found some links. The link
> of  pygene(http://www.freenet.org.nz/python/pygene) cannot be opened.

Strange, works for me...

>
> I also tried the recipe on ASPN, but it is too simple for my
> application, and the ga model in SciPy, which is in testing in the
> "sandbox".
>
> Are there any more genetic algorithms packages for Python ?
>

I am not (at all!) an specialist in genetic algorithms, but here are
some links :

http://pygp.sourceforge.net/
http://packages.qa.debian.org/g/genetic.html
and of course,
http://www.freenet.org.nz/python/pygene/

-- 
Thomas Samson
BOFH Excuse #420:
Feature was not beta tested
-- 
http://mail.python.org/mailman/listinfo/python-list