Re: Abstract Methods & Abstract Class

2005-10-20 Thread sébastien
or 

[...]
def method(self):
assert not "must be overrided"

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How run web software *locally* easily?

2006-01-06 Thread sébastien
for example like that: python -m CGIHTTPServer

-- 
http://mail.python.org/mailman/listinfo/python-list


Hot subject: a good python editor and/or IDE?

2007-08-19 Thread Sébastien
Hi folks,

I am currently using Eclipse+PyDev when developping Python projects but 
I lack a fast, simple editor for tiny bit of scripts. So here is my 
question: what is, for you, the current best ( but still kind of light! 
) Python editor/IDE ? A tiny precision, I am on Ubuntu so I am looking 
for a linux compatible editor.

Cheers,

Sébastien
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Any pointers/advice to help learn CPython source?

2006-05-19 Thread sébastien
There is also an interesting pep which describe the front-end

http://www.python.org/dev/peps/pep-0339/

It doesn't explain the whole things, but it gives few hints where to
start to read the code. BTW, the main difficulty is that there are fat
C files and you should ask yourself what do you want to learn, because
instead it can be interesting to read the compiler module or to look at
pypy source code. Obviously if your motivations are to understand some
internals of CPython you want to study CPython ! lol

-- 
sébastien  
http://seb.dbzteam.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-11 Thread Sébastien Volle
Could it have been made optional, like the trailing comma in list
declaration?

--
Seb

2011/7/11 Anthony Kong 

> Awesome! Thanks for blog post link
>
> Cheers
>
>
> On Tue, Jul 12, 2011 at 12:16 AM, Thomas Jollans  wrote:
>
>> On 07/11/2011 03:51 PM, Anthony Kong wrote:
>> > Hi, all,
>> >
>> > Lately I am giving some presentations to my colleagues about the python
>> > language. A new internal project is coming up which will require the use
>> > of python.
>> >
>> > One of my colleague asked an interesting:
>> >
>> > /If Python use indentation to denote scope, why it still needs
>> > semi-colon at the end of function declaration and for/while/if loop?/
>> >
>> > My immediate response is: it allows us to fit statements into one line.
>> > e.g. if a == 1: print a
>> >
>> > However I do not find it to be a particularly strong argument. I think
>> > PEP8 does not recommend this kind of coding style anyway, so one-liner
>> > should not be used in the first place!
>>
>> Basically, it looks better, and is more readable. A colon, in English
>> like in Python, means that something follows that is related to what was
>> before the colon. So the colon makes it abundantly clear to the human
>> reader that a block follows, and that that block is to be considered in
>> relation to what was just said, before the colon.
>>
>> Coincidentally, Guido wrote this blog post just last week, without which
>> I'd be just as much at a loss as you:
>>
>>
>> http://python-history.blogspot.com/2011/07/karin-dewar-indentation-and-colon.html
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>
>
> --
> /*--*/
> Don’t EVER make the mistake that you can design something better than what
> you get from ruthless massively parallel trial-and-error with a feedback
> cycle. That’s giving your intelligence _much_ too much credit.
>
> - Linus Torvalds
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Bitstream -- Binary Data for Humans

2018-03-05 Thread Sébastien Boisgérault
Hi everyone,

I have released bitstream, a Python library to manage binary data (at the byte 
or bit level), hopefully without the pain that this kind of thing usually 
entails :)

If you have struggled with this topic in the past, please take a look at the 
documentation (http://boisgera.github.io/bitstream/) and tell me what you think.

Cheers,

Sébastien
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bitstream -- Binary Data for Humans

2018-03-06 Thread Sébastien Boisgérault
Le mardi 6 mars 2018 00:29:25 UTC+1, Roel Schroeven a écrit :
> Sébastien Boisgérault schreef op 5/03/2018 20:05:
> > I have released bitstream, a Python library to manage binary data (at the 
> > byte or bit level),
>  > hopefully without the pain that this kind of thing usually entails :)
> > 
> > If you have struggled with this topic in the past, please take a look at 
> > the documentation
>  > (http://boisgera.github.io/bitstream/) and tell me what you think.
> 
> Hi Sébastien,
> 
> At work I have some Python code to decode AIS[1] messages, for which I 
> created my own code for handling binary data. It works, but is pretty 
> slow. Not surprising, since handling data at the bit level is not 
> exactly Python's strength. If I find the time, I'll try to replace my 
> code with your bitstream and see if it does what I need it to do, and if 
> it's any faster.
> 
> If/when I actually get around to it, I'll keep you informed.
> 
> [1] https://en.wikipedia.org/wiki/Automatic_identification_system
> 
> 
> Best regards,
> Roel
> 
> -- 
> The saddest aspect of life right now is that science gathers knowledge
> faster than society gathers wisdom.
>-- Isaac Asimov
> 
> Roel Schroeven

Great, thanks !
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

2018-03-06 Thread Sébastien Boisgérault
Hi Lawrence,

Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D’Oliveiro a écrit :
> On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, Sébastien Boisgérault wrote:
> > I have released bitstream, a Python library to manage binary data
> > (at the byte or bit level), hopefully without the pain that this kind
> > of thing usually entails :)
> 
> >byte_index = offset / 8
> 
> This will return a float.

The implementation is in Cython, which allows to declare types. 
The variable byte_index is defined as a size_t. 
Did I miss something? Do you mean that an intermediate float 
is used in the generated C code? I guess I should check that.
I realize now that I sometimes use the code above to get the bit
and bytes index and sometimes divmod ...

> 
> Also I notice you count bit positions from the top of each byte, rather than 
> from the bottom. Any reason for this?

I suppose that my mental representation of the bitstream is left-to-right 
(think sequence of bits) with bits being "big-endian"ish in each byte, 
therefore new bits enter from the left with big weights. Which should translate 
to your description. So, no, no specific reason for this I guess. Is one of the 
representation better that the other (wrt performance for example)?.

Cheers,

SB

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bitstream -- Binary Data for Humans

2018-03-06 Thread Sébastien Boisgérault
Le mardi 6 mars 2018 09:26:50 UTC+1, Sébastien Boisgérault a écrit :
> Le mardi 6 mars 2018 00:29:25 UTC+1, Roel Schroeven a écrit :
> > Sébastien Boisgérault schreef op 5/03/2018 20:05:
> > > I have released bitstream, a Python library to manage binary data (at the 
> > > byte or bit level),
> >  > hopefully without the pain that this kind of thing usually entails :)
> > > 
> > > If you have struggled with this topic in the past, please take a look at 
> > > the documentation
> >  > (http://boisgera.github.io/bitstream/) and tell me what you think.
> > 
> > Hi Sébastien,
> > 
> > At work I have some Python code to decode AIS[1] messages, for which I 
> > created my own code for handling binary data. It works, but is pretty 
> > slow. Not surprising, since handling data at the bit level is not 
> > exactly Python's strength. If I find the time, I'll try to replace my 
> > code with your bitstream and see if it does what I need it to do, and if 
> > it's any faster.
> > 
> > If/when I actually get around to it, I'll keep you informed.
> > 
> > [1] https://en.wikipedia.org/wiki/Automatic_identification_system
> > 
> > 
> > Best regards,
> > Roel
> > 
> > -- 
> > The saddest aspect of life right now is that science gathers knowledge
> > faster than society gathers wisdom.
> >-- Isaac Asimov
> > 
> > Roel Schroeven
> 
> Great, thanks !

Hi again Roel,

I had a look at the AIS message format from your link 
(https://en.wikipedia.org/wiki/Automatic_identification_system#Message_format) 
and this seems to be a nice use case; all the data components seem to be nicely 
aligned on the byte boundary ... until you see that the payload uses ASCII6(*), 
which I didn't know about. 

Thanks again for the info!

Cheers,

(*) ASCII6 code = ASCII code + 48; 
(http://catb.org/gpsd/AIVDM.html#_aivdm_aivdo_sentence_layer)
SB



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

2018-03-06 Thread Sébastien Boisgérault
Le mardi 6 mars 2018 10:23:02 UTC+1, Lawrence D’Oliveiro a écrit :
> On Tuesday, March 6, 2018 at 9:59:55 PM UTC+13, Sébastien Boisgérault wrote:
> > 
> > Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D’Oliveiro a écrit :
> >
> >> On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, Sébastien Boisgérault 
> >> wrote:
> >>>
> >>>byte_index = offset / 8
> >> 
> >> This will return a float.
> > 
> > The implementation is in Cython, which allows to declare types. 
> > The variable byte_index is defined as a size_t. 
> 
> Ah, I see. Still it seems unPythonic to use ”/” for integer division. Does it 
> not allow “//”?

Yes, '//' works, see:


https://mybinder.org/v2/gh/boisgera/jupyter-cython/master?filepath=Integer%20Division.ipynb

Actually, in this Jupyter notebook setting, this is '/' that doesn't work!
I should have a new look at this; since performance also matters,
I'd also like to have the Cython code with the smallest overhead 
(even if it is less readable/Pythonic).

Cheers,

SB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

2018-03-06 Thread Sébastien Boisgérault
Le mardi 6 mars 2018 11:15:15 UTC+1, Terry Reedy a écrit :
> On 3/6/2018 3:58 AM, Sébastien Boisgérault wrote:
> > Hi Lawrence,
> > 
> > Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D’Oliveiro a écrit :
> >> On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, Sébastien Boisgérault 
> >> wrote:
> >>> I have released bitstream, a Python library to manage binary data
> >>> (at the byte or bit level), hopefully without the pain that this kind
> >>> of thing usually entails :)
> >>
> >>> byte_index = offset / 8
> >>
> >> This will return a float.
> 
> byte_index // 8
> will give you the int index directly in both late 2.x and 3.x.

Indeed! And since this is Cython code, I *guess* that I should combine `//` 
with the 'cdivision' set to True to get the syntax that everyone understands 
*and* the pure C speed (see 
http://cython.readthedocs.io/en/latest/src/reference/compilation.html). I need 
to run some experiments to make sure that this behaves as expected, but this is 
very likely the way to go.



> -- 
> Terry Jan Redey

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Continuous system simulation in Python

2005-10-08 Thread Sébastien Boisgérault

Simulink is a framework widely used by the control engineers ...
It is not *perfect* but the ODEs piece is probably the best
part of the simulator. Why were you not convinced ?

You may also have a look at Scicos and Ptolemy II. These
simulators are open-source ... but not based on Python.

Cheers,

SB





Nicolas Pernetty a écrit :

> Hello Phil,
>
> Yes I have considered Octave. In fact I'm already using Matlab and
> decided to 'reject' it for Python + Numeric/numarray + SciPy because I
> think you could do more in Python and in more simple ways.
>
> Problem is that neither Octave, Matlab and Python offer today a
> framework to build continuous system simulator (in fact Matlab with
> Simulink and SimMechanics, do propose, but I was not convinced at all).
>
> Regards,
>
> *** REPLY SEPARATOR  ***
>
> On 7 Oct 2005 11:00:54 -0700, [EMAIL PROTECTED] wrote :
>
> > Nicholas,
> >
> > Have you looked at Octave? It is not Python, but I believe it can talk
> > to Python.
> > Octave is comparable to Matlab for many things, including having ODE
> > solvers. I have successfully used it to model and simulate simple
> > systems. Complex system would be easy to model as well, provided that
> > you model your dynamic elements with (systems of) differential
> > equations.
> >

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Continuous system simulation in Python

2005-10-10 Thread Sébastien Boisgérault
Nicolas,

I am aware of some shortcomings and design flaws of Simulink,
especially in the code generation area. I am interested by
your paper nonetheless, please send me copy.

However, Simulink is used by many people on a day-to-day basis
in the context of big, industrial projects. The claim that it
is "next to unusable" is, in my book, an overstatement ...

Scicos is not perfect either but you can hardly say that is
is a simple clone of Simulink. No time and space to go into
the details ...

Obviously, the python community is very dynamic, but how much
support will you get in the very specific topic of continuous
time systems simulation ?

IMHO, an hybrid approach, such as the development of bridge
to include Python components into Simulink/Scicos/Ptolemy/
Modelica/pick_your_favorite_simulator may grant you more
interest from the simulation community.

Cheers,

SB



Nicolas Pernetty wrote:
> Simulink is well fitted for small simulators, but when you run into big
> projects, I find many shortcomings appears which made the whole thing
> next to unusable for our kind of projects.
> That's why I'm interested in Python by the way, it is not a simple clone
> like Scilab/Scicos. It is a real language which bring its own
> advantages, and its own shortcomings, which I find well suited for our
> activity.
>
> If you want, I can send you a paper I wrote last year, detailing all
> Simulink shortcomings. I doubt that this mailing list is interested in
> such things...(and it's in French...).
> Concerning Scilab/Scicos, I'm not really interested in a technology
> primarily developed (INRIA and ENSPC) and used by France. Python and all
> its libraries and communities are so much more dynamic !
> And also I've heard that Scilab was developed in Fortran in a way which
> make it rigid and that the sources are poorly documented, not a good
> sign for an open source software (and Scilab isn't 'Free' for the FSF).
>
> Regards,
>
>
> *** REPLY SEPARATOR  ***
>
> On 8 Oct 2005 11:06:25 -0700, "Sébastien Boisgérault"
> <[EMAIL PROTECTED]> wrote :
>
> >
> > Simulink is a framework widely used by the control engineers ...
> > It is not *perfect* but the ODEs piece is probably the best
> > part of the simulator. Why were you not convinced ?
> >
> > You may also have a look at Scicos and Ptolemy II. These
> > simulators are open-source ... but not based on Python.
> >
> > Cheers,
> >
> > SB
> >
> >
> >
> >
> >
> > Nicolas Pernetty a écrit :
> >
> > > Hello Phil,
> > >
> > > Yes I have considered Octave. In fact I'm already using Matlab and
> > > decided to 'reject' it for Python + Numeric/numarray + SciPy because
> > > I think you could do more in Python and in more simple ways.
> > >
> > > Problem is that neither Octave, Matlab and Python offer today a
> > > framework to build continuous system simulator (in fact Matlab with
> > > Simulink and SimMechanics, do propose, but I was not convinced at
> > > all).
> > >
> > > Regards,
> > >
> > > *** REPLY SEPARATOR  ***
> > >
> > > On 7 Oct 2005 11:00:54 -0700, [EMAIL PROTECTED] wrote :
> > >
> > > > Nicholas,
> > > >
> > > > Have you looked at Octave? It is not Python, but I believe it can
> > > > talk to Python.
> > > > Octave is comparable to Matlab for many things, including having
> > > > ODE solvers. I have successfully used it to model and simulate
> > > > simple systems. Complex system would be easy to model as well,
> > > > provided that you model your dynamic elements with (systems of)
> > > > differential equations.
> > > >
> >

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's wrong with this code?

2005-07-02 Thread Sébastien Boisgérault


Nathan Pinno a écrit :
> Hi all,
>
>   What's wrong with the following code? It says there is name error, that
> random is not defined. How do I fix it?

Add "import random" at the top of your file

Cheers,

SB

>   # Plays the guessing game higher or lower.
>   # Originally written by Josh Cogliati, improved first by Quique, then by
> Nathan Pinno.
>   print "Higher or Lower"
>   print
>   number = random.choice(range(100))
>   guess = 0
>   while guess != number:
>   guess = input("Guess a number: ")
>   if guess > number:
>   print "Too high"
>   guess = input("Guess a number: ")
>   elif guess < number:
>   print "Too low"
>   guess = input("Guess a number: ")
>   print "Just right"
>
>   Thanks.
>   Nathan Pinno
>   http://www.npinnowebsite.ca/
>
>
>
> --
>
>
> 
>  Posted via UsenetRevolution.com - Revolutionary Usenet
> ** HIGH RETENTION ** Specializing in Large Binaries Downloads **
>  http://www.UsenetRevolution.com

-- 
http://mail.python.org/mailman/listinfo/python-list


C parser with spark

2005-07-03 Thread Sébastien Boisgérault
Hi,

Has anybody already implemented a full ANSI C parser
with John Aycock's spark module ?

(spark : http://pages.cpsc.ucalgary.ca/~aycock/spark/)

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Jython from CVS

2005-07-03 Thread Sébastien Ramage
Somebody can help me to recompile Jython from the CVS file ?


thank
--- 
other question : No python browser plugins avaible?


Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


sys.stdout

2005-09-09 Thread Sébastien Boisgérault
Hi,

The sys.stdout stream behaves strangely in my
Python2.4 shell:

>>> import sys
>>> sys.stdout.write("")
>>> sys.stdout.write("\n")

>>> sys.stdout.write("\n")

>>> sys.stdout.flush()
[...nothing...]

Have you ever seen sys.stdout behave like that ?
Any idea what is wrong with my Python2.4 install
or Linux (Mandrake 10.0) system ?

Cheers,

Sébastien

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdout

2005-09-09 Thread Sébastien Boisgérault
Tiissa,

Thanks for your answer. The execution of  your example leads to a
'aaa' display during 2 secs, before it is erased by the prompt.

This behavior is standard ? The standard output is not supposed
to *concatenate* the 'aaa' and the '>>>' ?

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdout

2005-09-09 Thread Sébastien Boisgérault

Robert Kern wrote:
> Sébastien Boisgérault wrote:
> > Tiissa,
> >
> > Thanks for your answer. The execution of  your example leads to a
> > 'aaa' display during 2 secs, before it is erased by the prompt.
> >
> > This behavior is standard ? The standard output is not supposed
> > to *concatenate* the 'aaa' and the '>>>' ?
>
> FWIW:
>
> Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> sys.stdout.write('')
> >>> sys.stdout.write('\n')
> 
> >>>
>
> --
> Robert Kern
> [EMAIL PROTECTED]

Robert,

I used to have exactly this behavior on my previous platform ...
In the good old days ;)

Do you know if this behavior is mandatory ? Can I *officially*
 state that my Python interpreter is broken ?

I have already tried to recompile and reinstall Python2.4
without any noticeable difference and the Python2.3 rpm
that I have tested exhibits the same behavior ... Doh !


SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdout

2005-09-09 Thread Sébastien Boisgérault

Fredrik Lundh wrote:
> Sébastien Boisgérault wrote:
>
> > Thanks for your answer. The execution of  your example leads to a
> > 'aaa' display during 2 secs, before it is erased by the prompt.
> >
> > This behavior is standard ? The standard output is not supposed
> > to *concatenate* the 'aaa' and the '>>>' ?
>
> what "python shell" are you using, and what platform are you running
> it on?

The python interpreter is invoked from a bash/konsole session,
inside a KDE env.:

bash$ python
Python 2.4.1 (#4, Sep  8 2005, 19:11:54)
[GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>>

> here's what I get on a standard Unix console:
>
> >>> import sys
> >>> sys.stdout.write("")
> >>> sys.stdout.write("\n")
> 
> >>> sys.stdout.write("\n")
> 
> >>>
> 
> 

Yep. And I hate you for this ;)

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdout

2005-09-09 Thread Sébastien Boisgérault

Fredrik Lundh a écrit :

> > what "python shell" are you using, and what platform are you running
> > it on?  here's what I get on a standard Unix console:
> >
>  import sys
>  sys.stdout.write("")
> > >>> sys.stdout.write("\n")
> > 
>  sys.stdout.write("\n")
> > 
> > >>>
>
> btw, what does
>
> >>> sys.stdout.encoding
>
> print ?
> 
> 


   >>> sys.stdout.encoding
   'ISO-8859-15'


SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdout

2005-09-09 Thread Sébastien Boisgérault

Jorgen Grahn a écrit :

> On 9 Sep 2005 03:40:58 -0700, Sébastien Boisgérault <[EMAIL PROTECTED]> wrote:
> >
> > Fredrik Lundh wrote:
> >> Sébastien Boisgérault wrote:
> >>
> >> > Thanks for your answer. The execution of  your example leads to a
> >> > 'aaa' display during 2 secs, before it is erased by the prompt.
> >> >
> >> > This behavior is standard ? The standard output is not supposed
> >> > to *concatenate* the 'aaa' and the '>>>' ?
> >>
> >> what "python shell" are you using, and what platform are you running
> >> it on?
> >
> > The python interpreter is invoked from a bash/konsole session,
> > inside a KDE env.:
>
> So, it's either of these things:
> - konsole and its bugs/features

Nothing that I could do about it ;)

> - your $TERM settings

My xterm settings ?

> - your readline and its bugs/features

Uh Uh ... I have disabled my $PYTHONSTARTUP script that
was using some features of the readline module, but
without any success ...

> - your ~/.inputrc settings (see the readline man page)

INPUTRC refers to the default Mandrake settings in
etc/inputrc. An old version, 2002. It should be
mostly harmless, right  ...

> It's hard to say what's right and wrong really, and whose fault it is.
> I'm pretty sure it's not Python.  What happens if you try bash?
>
>   tuva:~> bash
>   [EMAIL PROTECTED]:~$ echo -n 'foo'
>   [EMAIL PROTECTED]:~$

Bash (into a konsole, same conditions than befor) seems to be ok:

[EMAIL PROTECTED] boisgera]$ echo -n 'foo'
[EMAIL PROTECTED] boisgera]$

:(

Cheers,

SB

> /Jorgen
>
> --
>   // Jorgen Grahn  \X/algonet.se>   R'lyeh wgah'nagl fhtagn!

-- 
http://mail.python.org/mailman/listinfo/python-list


fpectl

2005-04-18 Thread Sébastien Boisgérault
Hi all,

Can anybody tell me why I can't load the fpectl module in my Python
interpreter:

>>> import fpectl
Traceback: ...
...
ImportError: No module named fpectl

My platform is Linux (Mandrake 10.x) + Python2.4, built from the
(python.org) sources and configured with the --with-fpectl option.

Any idea ? Is the Python Library Reference obsolete on this point or
did I miss something ?

I have understood from the previous posts on the subject that the whole
floating-point issue (or specifically IEEE 754 support) is quite
complex
and highly platform-dependent. Therefore I guess that I cannot take for
granted the expected behavior of fpectl functions. But at least I
should
be able to import it, shouldn't I ? 

Cheers,

S.B.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fpectl

2005-04-19 Thread Sébastien Boisgérault
Thanks for this answer.

Did you forward this info to python-dev ?

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fpectl

2005-04-19 Thread Sébastien Boisgérault

Good ! And thanks for the link. I had not noticed the warning "fpectl
module is dangerous" before.

I am a bit sad that the floating-point issue is disappearing from the
*active topics* list ...

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


doctest's ELLIPSIS

2005-04-29 Thread Sébastien Boisgérault
Hi,

Can anybody come up with a sensible argument that would explain
why the following test should fail ? (Expected: nothing, Got: 42).

cheers,

S.B.


#!/usr/bin/env python

import doctest

def test():
"""
>>> print 42 #doctest: +ELLIPSIS
...
"""

def run():
"Run the test."
doctest.testmod()

if __name__ == '__main__':
run()



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: doctest's ELLIPSIS

2005-04-29 Thread Sébastien Boisgérault

Doh ! Obviously ... too bad.

I guess that I could set doctest.ELLIPSIS_MARKER to "[...]" to
distinguish
the two usages of "...". (The "..." used for multiline statements is
hard-coded
into a regular expression pattern).

But it feels too hackish, ELLIPSIS_MATKER being not described in the
docs ...   

Well, anyway, thanks for your insight.

S.B.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: doctest's ELLIPSIS

2005-04-29 Thread Sébastien Boisgérault
Done.

-- 
http://mail.python.org/mailman/listinfo/python-list


Python problem

2015-10-09 Thread Sébastien Pinsonneault
Hi,

I've downloaded Python 3.5.0 64 bits, but I can't open it. It ask me each
time if I want to modify, repair or uninstall, but doesn't open.

I have Windows 10 64 bits.

Thx
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Sébastien Boisgérault

Robert Kern wrote:
> J wrote:
> > I will just jump in an use NumPy. I hope this one will stick and evolve
> > into the mother of array packages.
> > How stable is it ? For now I really just need basic linear algebra.
> > i.e. matrix multiplication, dot, cross etc

Same concern for me.

I discovered recently that I could not rely on numeric anymore
because 'eigenvalue' is now broken on my platform. This bug
has been referenced but not corrected AFAIK. Too bad that
numeric is not actively maintained anymore. Easy-to-install,
good doc, well-thought interface, really good stuff !

Bye-bye Numeric !

By the way, I tried numpy 0.9.4 10 minutes ago and guess
what ? 'eigenvalue' is broken too ... (hangs forever)

I do really hope the numpy will become the robust, best-of-breed
Python Array/Matrix lib that many people are waiting for. But in
the meantime, it's back to Matlab :(

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Python strings outside the 128 range

2006-07-13 Thread Sébastien Boisgérault

Hi,

Could anyone explain me how the python string "é" is mapped to
the binary code "\xe9" in my python interpreter ?

"é" is not present in the 7-bit ASCII table that is the default
encoding, right ? So is the mapping "é" -> "\xe9" portable ?
(site-)configuration dependent ? Can anyone have something
different of "é" when 'print "\xe9"' is executed ? If the process
is config-dependent, what kind of config info is used ?

Regards,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python strings outside the 128 range

2006-07-13 Thread Sébastien Boisgérault

Fredrik Lundh wrote:

> in the iso-8859-1 character set, the character é is represented by the code
> 0xE9 (233 in decimal).  there's no mapping going on here; there's only one
> character in the string.  how it appears on your screen depends on how you
> print it, and what encoding your terminal is using.

Crystal clear. Thanks !

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python for Embedded Systems?

2006-07-15 Thread Sébastien Boisgérault
Jack a écrit :

> If Python is not the best candidate for embedded systems because
> of the size, what (scripting) language would you recommend?
>
> PHP may fit but I don't quite like the language. Anything else?
> Loa is small but it does not seem to be powerful enough.

You mean Lua ? Not powerful enough ? What do you mean by
that ? Lua is great IMHO. Sure it does not come with thousands
of libraries, but the language design is extremely clean, the
language constructs powerful and the footprint very small.

16kloc of C code can't hurt your embedded device can they ? ;)

Please tell us what kind of limitation you find in Lua ...

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


ElementTree and Unicode

2006-08-02 Thread Sébastien Boisgérault

I guess I am doing something wrong ... Any clue ?

>>> from elementtree.ElementTree import *
>>> element = Element("string", value=u"\x00")
>>> xml = tostring(element)
>>> XML(xml)
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.4/site-packages/elementtree/ElementTree.py",
line 960, in XML
parser.feed(text)
  File "/usr/lib/python2.4/site-packages/elementtree/ElementTree.py",
line 1242, in feed
self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1,
column 15

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ElementTree and Unicode

2006-08-02 Thread Sébastien Boisgérault

Richard Brodie wrote:
> "Sébastien Boisgérault" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> >>>> element = Element("string", value=u"\x00")
>
> I'm not as familiar with elementtree.ElementTree as I perhaps
> should be. However, you appear to be trying to insert a null
> character into an XML document. Should you succeed in this
> quest, the resulting document will be ill-formed, and any
> conforming parser will choke on it.

I am trying to embed an *arbitrary* (unicode) strings inside
an XML document. Of course I'd like to be able to reconstruct
it later from the xml document ... If the naive way to do it does
not work, can anyone suggest a way to do it ?

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ElementTree and Unicode

2006-08-02 Thread Sébastien Boisgérault

Martin v. Löwis wrote:
> Sébastien Boisgérault schrieb:
> > I am trying to embed an *arbitrary* (unicode) strings inside
> > an XML document. Of course I'd like to be able to reconstruct
> > it later from the xml document ... If the naive way to do it does
> > not work, can anyone suggest a way to do it ?
>
> XML does not support arbitrary Unicode characters; a few control
> characters are excluded. See the definiton of Char in
>
> http://www.w3.org/TR/2004/REC-xml-20040204
>
> [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] |
> [#xE000-#xFFFD] | [#x1-#x10]
>
> Now, one might thing you could use a character reference
> (e.g. �) to refer to the "missing" characters, but this is not so:
>
>
> [66]  CharRef ::=  '&#' [0-9]+ ';'
>  | '&#x' [0-9a-fA-F]+ ';
>
> Well-formedness constraint: Legal Character
> Characters referred to using character references must match the
> production for Char.
>
> As others have explained, if you want to transmit arbitrary characters,
> you need to encode it as text in some way. One obvious solution
> would be to encode the Unicode data as UTF-8 first, and then encode
> the UTF-8 bytes using base64. The receiver of the XML document then
> must do the reverse.
>
> Regards,
> Martin

OK ! Thanks a lot for this helpful information.

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Max-plus library

2006-10-17 Thread Sébastien Boisgérault
Robert Kern wrote:
> Martin Manns wrote:
> > Hello,
> >
> > Is there any library that allows employing max-plus dioids in
> > python (e.g. based on numpy/scipy)?
>
> Google says "no" and I haven't heard of any, so I imagine that there aren't.
> There might be something buried in some of the control theory packages, but 
> as I
> neither know what max-plus dioids are, nor have I any current interest in 
> them,
> I can't give you any better pointers.

See http://cermics.enpc.fr/~cohen-g//SED/index-e.html for a two-page
introduction to the field and its applications. Definitely worth a look
IMHO.

The second software you refer to
(http://www-rocq.inria.fr/MaxplusOrg/soft.html) is a Scilab package but
essentially made of C and Fortran files. Getting a working binding for
Python may not be that hard ...

Cheers,

SB

>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>   that is made terrible by our own mad attempt to interpret it as though it 
> had
>   an underlying truth."
>-- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN compiler2 : Produce bytecode from Python 2.5 Abstract Syntax Trees

2006-10-28 Thread sébastien martini
Hi,

> I was primarily talking about language support. For quite some time,
> the compiler package wasn't able to compile the Python standard library,
> until Guido van Rossum (and others) brought it back to work at the last
> PyCon. It would simply reject certain more recent language constructs.
> In the process of fixing it, it was also found to deviate from the
> normal language definition, i.e. it would generate bad code.
>
> Many of these are fixed, but it wouldn't surprise me if there are
> still bugs remaining.

I don't know if it can hide some bugs or if the module has just never
been updated to support this bytecode but LIST_APPEND is never emitted.
In the module compiler, list comprehensions are implemented without
emitting this bytecode, howewer the current implementation seems to be
correct from syntax and execution point of view.

For example:
>>> src = "[a for a in range(3)]"
>>> co = compiler.compile(src, 'lc1', 'exec')
>>> co
 at 0x404927b8, file "lc1", line 1>
>>> dis.dis(co)
  1   0 BUILD_LIST   0
  3 DUP_TOP
  4 LOAD_ATTR0 (append)
  7 STORE_NAME   1 ($append0)
 10 LOAD_NAME2 (range)
 13 LOAD_CONST   1 (3)
 16 CALL_FUNCTION1
 19 GET_ITER
>>   20 FOR_ITER16 (to 39)
 23 STORE_NAME   3 (a)
 26 LOAD_NAME1 ($append0)
 29 LOAD_NAME3 (a)
 32 CALL_FUNCTION1
 35 POP_TOP
 36 JUMP_ABSOLUTE   20
>>   39 DELETE_NAME  1 ($append0)
 42 POP_TOP
 43 LOAD_CONST   0 (None)
 46 RETURN_VALUE
>>> co2 = compile(src, 'lc2', 'exec')
>>> co2
 at 0x40492770, file "lc2", line 1>
>>> dis.dis(co2)
  1   0 BUILD_LIST   0
  3 DUP_TOP
  4 STORE_NAME   0 (_[1])
  7 LOAD_NAME1 (range)
 10 LOAD_CONST   0 (3)
 13 CALL_FUNCTION1
 16 GET_ITER
>>   17 FOR_ITER13 (to 33)
 20 STORE_NAME   2 (a)
 23 LOAD_NAME0 (_[1])
 26 LOAD_NAME2 (a)
 29 LIST_APPEND
     30 JUMP_ABSOLUTE   17
>>   33 DELETE_NAME  0 (_[1])
 36 POP_TOP
 37 LOAD_CONST   1 (None)
 40 RETURN_VALUE

Cordially,

sébastien martini

-- 
http://seb.dbzteam.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (mostly-)POSIX regular expressions

2006-05-28 Thread Sébastien Boisgérault
Very good hint ! I wouldn't have found it alone ...

I have to study the doc, but the "THE DFA MATCHING ALGORITHM" may do
what I need Obviously, I didn't expect the Perl-Compatible Regular
Expressions to implement
"an alternative algorithm, provided by the pcre_dfa_exec() function,
that operates in a different way, and is not  Perl-compatible".

Maybe the lib should be renamed in PCREWSO for:
Perl-compatible regular expressions ... well, sort of :)

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (mostly-)POSIX regular expressions

2006-05-28 Thread Sébastien Boisgérault

Paddy a écrit :

> maybe this: http://www.pcre.org/pcre.txt and ctypes might work for you?

Well finally, it doesn't fit. What I need is a "longest match" policy
in
patterns like "(a)|(b)|(c)" and NOT a "left-to-right" policy.
Additionaly,
I need to be able to obtain the matched ("captured") substring and
the PCRE does not allow this in DFA mode.

Too bad ...

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (mostly-)POSIX regular expressions

2006-05-29 Thread Sébastien Boisgérault
John Machin wrote:
> On 29/05/2006 7:46 AM, Sébastien Boisgérault wrote:
> > Paddy a écrit :
> >
> >> maybe this: http://www.pcre.org/pcre.txt and ctypes might work for you?
> >
> > Well finally, it doesn't fit. What I need is a "longest match" policy
> > in
> > patterns like "(a)|(b)|(c)" and NOT a "left-to-right" policy.
> > Additionaly,
> > I need to be able to obtain the matched ("captured") substring and
> > the PCRE does not allow this in DFA mode.
> >
>
> Perhaps you might like to be somewhat more precise with your
> requirements.

Sure. More on this below.

> "POSIX-compliant" made me think of yuckies like [:fubar:]
> in character classes :-)

Yep. I do not need POSIX *syntax* for regular expressions but POSIX
*semantics*, at least the "leftmost-longest" part (in contrast to the
"first then longest" used in Python, Perl, .NET, etc.)

> The operands of | are such that the length is not fixed and so you can't
> write them in descending length order? Care to tell us some more detail
> about those operands?

Basically, I'd like to use the (excellent) python module SPARK
of John Aycock to build an (extended) C lexer. To do so, I need
to specify the patterns that match my tokens as well as a priority
between them. SPARK then builds a big alternate list of patterns
that begins with the high priority patterns and ends with the low
priority patterns and runs a match.

The problem with to be very careful and to specify explicitely the
priorities to get the desired results: "<=" shall be higher than "<",
decimal stuff higher than integer, etc, when most of the time what
you really want is to match the longest pattern ...

Worse, the priority work-around does not work well when you
compare keywords and (other) identifiers. To match "fortune"
as a identifier, you would need to define identifier with a higher
priority than keyword and it is a problem: "for" would be then
match as a identifier when it is a keyword.

I can come up with possible work-arounds for the "id vs
keyword" issue, but nothing that really makes me happy ...
Therefore, I was studying the possible replacement of the
Python native regular expression engine with a "POSIX
semantics" regular expression engine that would give the
longest match and avoid me a lot of extra work ...

I hope it's clearer now :)

Any advice ?

Cheers

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: capture video from camera

2006-06-06 Thread Sébastien Boisgérault

aljosa wrote:
> i searched on google and found http://videocapture.sourceforge.net/
> before i posted here.

yup.

> videocapture has no docs

With the API docs in the ".zip" and the examples provided, you
should be able to handle it.I did :)

> and doesn't provide additional options like
> motion detection nor any info on possibility of motion detection or
> howto implement (use of minimal system resources).

Sure. You may try to use some external lib such as Camellia
(http://camellia.sourceforge.net/). There are (swig-generated)
bindings for Ruby, writing a bridge to python should be
straightforward

By the way, if you want to be cross-platform, you can use pyv4l
as a replacement of videocapture for Linux. Combine this with a
pygame integration and you're done.

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Sébastien Boisgérault
Jeez, 12 posts in this IEEE 754 thread, and still
no message from uncle timmy ? ;)

Please, we need enlightenment here and *now* :)

platform-dependent accident'ly yours,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: language design question

2006-07-10 Thread Sébastien Boisgérault
Steven Bethard a écrit :

> The advantage of a functional form over a method shows up when you write
> a function that works on a variety of different types. Below are
> implementations of "list()", "sorted()" and "join()" that work on any
> iterable and only need to be defined once::
>
> [... skipped ...]
>
> Now, by providing these as functions, I only have to write them once,
> and they work on *any* iterable, including some container object that
> you invent tomorrow.

Yep. Rubyphiles would probably define these 3 methods in a "module"
Iterable and "mix" it in their brand new container classes.
These classes then automatically have list, sorted and join *as
methods*.

Guess you could use this kind of trick in Python if you can live with
heavy *and* implicit surgery of the inheritance chain ;)

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


PyOpenGL pour python 2.5 ???

2006-09-25 Thread Sébastien Ramage
Bonjour à tous,

Dans la folie j'ai installé le nouveau python, impatient de voir les
nouveautés
mais je pense que j'ai été un peu rapide car j'ai voulu utiliser
pyOpenGL et là problème il n'existe pas pour python 2.5 ?!!! de plus
il semble que pyopengl est été abandonné depuis 2005 ? plus rien ne
bouge sur le site...

je suis sous windows et je ne dispose pas des outils pour faire moi
même une compilation, (en supposant qu'il n'y aurait que ça a faire)

alors si quelqu'un a plus d'info pour utiliser l'opengl avec python
2.5...


Merci
Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyOpenGL pour python 2.5 ???

2006-09-25 Thread Sébastien Ramage
oh!
sorry, I made some search on comp.lang.python and fr.comp.lang.python
and finally I forgot where I was...

My question is :
how use pyopengl with python 2.5 ??
it seems that pyopengl was stop on 2005

I'm on windows and I've not tools to recompile pyopengl for python 2.5
(thinking recompilation is the only things)

Somebody can help me?

Seb





Bruno Desthuilliers a écrit :

> Sébastien Ramage wrote:
> > Bonjour à tous,
>
>
> Hi Sébastien.
>
> Wrong newsgroup, I'm afraid - either repost here in english, or post to
> fr.comp.lang.python...
>
>
> --
> bruno desthuilliers
> python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
> p in '[EMAIL PROTECTED]'.split('@')])"

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyOpenGL pour python 2.5 ???

2006-09-25 Thread Sébastien Ramage
good news !

thank for links to the blog, very usefull

now I have to wait

seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ElementTree and proper identation?

2006-09-27 Thread Sébastien Boisgérault

John Salerno a écrit :

> I've been doing a little studying of ElementTree and it doesn't seem
> very satisfactory for writing XML files that are properly
> formatted/indented. I saw on the website that there is an
> indent/prettyprint function, but this isn't listed in the Python docs
> and I didn't see it after doing a dir(), so I guess it isn't a part of
> the Python version.

It *may* be included in a *future* release of ElementTree. For now, why
don't
you simply drop the 12 lines of codes of the prettyprint function into
your
project ? Source available at http://effbot.org/zone/element-lib.htm

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


How Build VTK for Python 2.5 under Windows?

2006-10-03 Thread Sébastien Ramage
Hello,
I'm running on Windows and I want to test VTK but I don't understand
how build it

Somebody can help me to build VTK for Python 2.5 under Windows? (or
Python 2.43 if python 2.5 is a problem)

I have no C compiler but I can install one if it's free.

Thank you

Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How Build VTK for Python 2.5 under Windows?

2006-10-03 Thread Sébastien Ramage
I've install MS Visual C++ toolkit 2003 and cmake
but I don't really know how it work.

there's somebody who can compile VTK for python 2.5 under windows for
me ?

thank you

(And sorry for my english, I'm French)

Seb



Sébastien Ramage wrote:
> Hello,
> I'm running on Windows and I want to test VTK but I don't understand
> how build it
>
> Somebody can help me to build VTK for Python 2.5 under Windows? (or
> Python 2.43 if python 2.5 is a problem)
>
> I have no C compiler but I can install one if it's free.
> 
> Thank you
> 
> Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About alternatives to Matlab

2006-11-17 Thread Sébastien Boisgérault


On Nov 16, 10:46 pm, "John Henry" <[EMAIL PROTECTED]> wrote:
> Bill Gates will have you jailed! :-)
>
> On a more serious note, is there any alternative to Simulink though?

Ptolemy II. Java stuff in the core but components may be written in
Python

http://ptolemy.eecs.berkeley.edu/ptolemyII/
http://ptolemy.eecs.berkeley.edu/ptolemyii/ptII5.0/ptII/doc/codeDoc/ptolemy/actor/lib/python/PythonScript.htm

> sturlamolden wrote:
> >and is infinitely
> > more expensive.
>
> > Does anyone wonder why I am not paying for Matlab maintenance anymore?
>
> > Sorry Mathworks, I have used your product for years, but you cannot
> > compete with NumPy.
> 
> > Cheers,
> > Sturla Molden

-- 
http://mail.python.org/mailman/listinfo/python-list


Pydev configuration

2006-11-24 Thread Sébastien Boisgérault
Hi,

Did anyone managed to change the code font family/size
in Pydev (Python Editor Plugin for Eclipse) ? I found how
to change the color mapping (Windows/Preference/Pydev)
but did not found the font setting.

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pydev configuration

2006-11-24 Thread Sébastien Boisgérault


On Nov 24, 9:42 pm, tool69 <[EMAIL PROTECTED]> wrote:
> Sébastien Boisgérault a écrit :> Hi,
>
> > Did anyone managed to change the code font family/size
> > in Pydev (Python Editor Plugin for Eclipse) ? I found how
> > to change the color mapping (Windows/Preference/Pydev)
> > but did not found the font setting.
>
> > Cheers,
>
> > SBSalut Sébastien,
>
> Preferences/General/Appearence/Colors&Fonts/ in the right menu choose
> Basic/Text Font

Ah ... Thanks a lot ! I had tweaked in the neighbourhood of this
option
but it was unclear for me that "Text Font" did also refer to Python
code.

'Bitsream Vera Sans Mono', here I come ;)

Cheers

SB

> 6TooL9

-- 
http://mail.python.org/mailman/listinfo/python-list


Python Plugin for Web Browser

2006-12-05 Thread Sébastien Ramage
I've an idea and I've made some search but I found nothing really
interesting.
There is somebody who have (or can help me to) try to developp a python
plugin for web browser just like java ??

I search an how-to for creating a plugin for Firefox and only find how
create extension...

I've find some informations about Python Active Scripting but this is
not what I want.

Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-06 Thread Sébastien Ramage
des exemples de plugins pour IE oui mais qui ne sont pas embarqué dans
une page Web
je souhaiterai créer qqchose qui ressemble vraiment à Java VM ou
Flash
J'ai trouvé un début de réponse pour Firefox en télécharger le
GeckoSDK
mais je n'arrive pas à compiler les exemples pour le moment...

merci


MC a écrit :

> Bonjour !
>
> Pour IE, il y a des exemples de plugins, fournis avec PyWin32.
> Pour FF (comme pour Opera), je ne sais pas.
> 
> -- 
> @-salutations
> 
> Michel Claveau

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Plugin for Web Browser

2006-12-06 Thread Sébastien Ramage

oui COM je connais et ça fonctionne bien mais ce n'est pas portable
d'un navigateur à l'autre et ce n'est pas ce que je cherche à faire.
Mon but serait d'avoir un plugin qui permettrait d'embarquer des
applets écrient en python dans les pages html à l'image de Java ou
Flash, etc
Pour le moment j'essaie de générer un plugin pour firefox avec le
Gecko SDK fourni par Mozilla (car bizarrement je ne trouve rien coté
IE...) mais ce n'est pas gagné vu mon niveau en C++... Je n'arrive pas
à compiler l'exemple.
As-tu des connaissances en C++ ? avec Visual C++ ?

Seb


Michel Claveau a écrit :

> Re !
>
> Je ne sais pas quel est ton objectif, mais il est possible de couplet
> Python & Javascript, de manière à générer/modifier/piloter le contenu
> HTML de pages Web depuis Python. Je fais ça tous les jours (avec IE)
>
> Pour cela je passe par COM.
>
> Malheureusement, à cause de la paranoïa sécuritaire ambiante, il y a de
> plus en plus de contraintes et d'obtacles.
>
> Ainsi, s'il n'y a pas (encore) trop de problèmes tant que l'on est en
> local (avec les .HTA, par exemple), dès que l'on est distant (Intranet,
> Extranet, Web), il y a maintenant des confirmations à tout bout de
> champ, des avertissements peu utiles, mais devenus incontournables, des
> boîte de dialogues intempestives, etc.
>
> Donc, si c'est pour utiliser comme interface pour des applis sur le
> disque (ou le réseau local), OK ; sinon, ça posera des problèmes.
>
> C'en est à tel point que je me demande si l'utilisation de frontaux
> HTML comme GUI est toujours intéressante.
> Et le problème ne touche pas que Python. Par exemple, j'ai un client
> qui utilise un logiciel de gestion de l'assurance qualité, utilisant
> des navigateurs comme interface. Du coup, ils ont des patchs 2 fois par
> mois, et les utilisateurs ont toujours plus choses à valider...
> 
> -- 
> @-salutations
> 
> Michel Claveau

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-06 Thread Sébastien Ramage


> Par contre, je pense qu'il existe une autre démarche, qui consiste à
> générer, à la volée, en Python, des sortes d'applets java/javascript.

Il est clair que mon projet est un peu plus complexe mais je l'espère
plus ambitieux aussi
Le but étant vraimment de faire des applets en Python et non Java via
Jython ou autre


> Avantages : rien à installer ; milti-navigateurs
> Inconvénient : ça se programme côté serveur.
> Voir : Pyjamas (http://pyjamas.pyworks.org/FR/overview/)

oui d'ailleurs un utilisateur de Pyjamas m'a déjà contacté et il
serait intéressé par un plugin tel que je l'imagine.
Concernant les avantages je ne suis pas d'accord avec toi:
- "rien à installer" : oui par javascript mais non pour java il y a le
runtime à installer donc finalement avoir un runtime Python pourquoi
pas
- multi-navigateur : idem, rien n'interdit d'avoir un plugin
multi-plateforme et multi-navigateur, Java le fait bien lui alors
pourquoi pas Python

bref ça va certainement poser des tas de problèmes de sécurité et
je pense qu'un plugin 100% opérationnel ne verra pas le jour avant un
bon moment mais rien n'empèche de se lancer dans l'aventure !

Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


ElementTree, XML and Unicode -- C0 Controls

2006-12-11 Thread Sébastien Boisgérault
Hi all,

The unicode code points in the -001F range --
except newline, tab, carriage return -- are not legal
XML 1.0 characters.

Attempts to serialize and deserialize such strings
with ElementTree will fail:

>>> elt = Element("root", char=u"\u")
>>> xml = tostring(elt)
>>> xml
''
>>> fromstring(xml)
   [...]
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1,
column 12

Good ! But I was expecting a failure *earlier*, in
the "tostring" function -- I basically assumed that
ElementTree would refuse to generate a XML
fragment that is not well-formed.

Could anyone comment on the rationale behind
the current behavior ? Is it a performance issue,
the search for non-valid unicode code points being
too expensive ?

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ElementTree, XML and Unicode -- C0 Controls

2006-12-11 Thread Sébastien Boisgérault


On Dec 11, 4:51 pm, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> Sébastien Boisgérault wrote:
> > Could anyone comment on the rationale behind
> > the current behavior ? Is it a performance issue,
> > the search for non-valid unicode code points being
> > too expensive ?
> the default serializer doesn't do any validation or well-formedness checks at 
> all; it assumes
> that you know what you're doing.
> 
> 

Fair enough !

Thanks Fredrik.

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-12 Thread Sébastien Ramage
pour ceux que ça intéresse

http://base.google.com/base/a/1438658/D18001067256043490325

-- 
http://mail.python.org/mailman/listinfo/python-list


Sybase module 0.38pre1 released

2006-12-12 Thread Sébastien Sablé
WHAT IS IT:

The Sybase module provides a Python interface to the Sybase relational
database system.  It supports all of the Python Database API, version
2.0 with extensions.

MAJOR CHANGES SINCE 0.37:

* This release works with python 2.5

* It also works with sybase 15

* It works with 64bits clients

* It can be configured to return native python datetime objects

* The bug "This routine cannot be called because another command
structure has results pending." which appears in various cases has
been corrected

* It includes a unitary test suite based on the dbapi2.0 compliance
test suite
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Validate XML against a set of XSD files, with Python

2006-12-12 Thread Sébastien Boisgérault

Laszlo Nagy wrote:
> Do you know an open source lib that can do $subject?

Fast google query, uncheked, leads to:

  - XSV: http://www.ltg.ed.ac.uk/~ht/xsv-status.html
  - libxml : http://codespeak.net/lxml/

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sybase module 0.38pre1 released

2006-12-13 Thread Sébastien Sablé
By the way, I forgot to say that new releases can now be downloaded
from this page:

https://sourceforge.net/project/showfiles.php?group_id=184050

regards

--
Sébastien Sablé

2006/12/12, Sébastien Sablé <[EMAIL PROTECTED]>:
> WHAT IS IT:
>
> The Sybase module provides a Python interface to the Sybase relational
> database system.  It supports all of the Python Database API, version
> 2.0 with extensions.
>
> MAJOR CHANGES SINCE 0.37:
>
> * This release works with python 2.5
>
> * It also works with sybase 15
>
> * It works with 64bits clients
>
> * It can be configured to return native python datetime objects
>
> * The bug "This routine cannot be called because another command
> structure has results pending." which appears in various cases has
> been corrected
>
> * It includes a unitary test suite based on the dbapi2.0 compliance
> test suite
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Validate XML against a set of XSD files, with Python

2006-12-13 Thread Sébastien Boisgérault

On Dec 13, 2:28 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote:
> > Fast google query, uncheked, leads to:
>
> >   - XSV:http://www.ltg.ed.ac.uk/~ht/xsv-status.htmlI tried this before. 
> > Unfortunately, xsv is not officially supported on
> my system (FreeBSD 6.1) :-(>   - libxml :http://codespeak.net/lxml/Probably 
> this is what I need to use. (However, I see in the mailing
> lists that there are problems with this part of libxml2.)

Yep, maybe. I suspect some issues with the validation of Relax NG
documents,
at least with the libxml2 that was used in my lxml build ...

> Thank you,
> 
>Laszlo

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Validate XML against a set of XSD files, with Python

2006-12-15 Thread Sébastien Boisgérault

Stefan Behnel wrote:

> RelaxNG support in libxml2 is pretty much perfect, BTW.

The *potential* issue I mentioned before with Relax NG
validation in libxml2 does *NOT* exist.

I double-checked with Jing and my RelaxNG file was
indeed incorrect ... (the "recursive reference outside
elements" kind of mistake). Jing more detailled
error reports helped ...

Mea Maxima Culpa. Wouldn't like to spread FUD :)

Cheers

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


ElementTree and utf-16 encoding

2006-12-19 Thread Sébastien Boisgérault

Hi,

ET being ElementTree in the following code, could anyone explain
why it fails ?

>>> xml = ET.tostring(ET.Element("root"), "UTF-16")
>>> xml
"\n<\xff\xfer\x00o\x00o\x00t\x00
/>"
>>> ET.fromstring(xml)
Traceback (most recent call last):
...
xml.parsers.expat.ExpatError: encoding specified in XML declaration is
incorrect: line 1, column 30

I s it related to the lack of BOM in the xml string ?
I tried to add some "\xff\xfe" or "\xfe\xff" at the start of the xml
string without much sucess with fromstring so far ...

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ElementTree and utf-16 encoding

2006-12-19 Thread Sébastien Boisgérault


On Dec 19, 10:49 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Sébastien Boisgérault wrote:
> > ET being ElementTree in the following code, could anyone explain
> > why it fails ?I'm afraid the standard serializer in 1.2 only supports 
> > ASCII-compatible
> encodings.  this will be fixed in 1.3.
>
> as a workaround, you can do:
>
>  tostring(elem).decode("utf-8").encode("utf-16")
> 
> 

OK, thanks.

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-23 Thread Sébastien Boisgérault
Robert Kern wrote:
> Sébastien Boisgérault wrote:
>
> > By the way, I tried numpy 0.9.4 10 minutes ago and guess
> > what ? 'eigenvalue' is broken too ... (hangs forever)
>
> On what platform?
Linux, Mandriva 2006 (gcc 4.0.1, etc.)
> Are you linking against an optimized BLAS?
Nope -- I tried the basic install.

> We can't fix
> anything without details.
Obviously, sorry. I was not really expecting a fix,
just wanted to point out that Numpy (or Numeric)
may well not work "out of the box" today on some
platforms.

The (similar) problem has been reported  (2005-07-11)
is not assigned to anybody and is still open
See: http://sourceforge.net/tracker/?group_id=1369&atid=101369

> I'll be happy to work with you on this bug over on the
> numpy-discussion list.

Great Robert,  I will follow your advice then. Thanks
for the proposal.
> --
> Robert Kern
> [EMAIL PROTECTED]
>
> "In the fields of hell where the grass grows high
>  Are the graves of dreams allowed to die."
>   -- Richard Harter.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-23 Thread Sébastien Boisgérault

[EMAIL PROTECTED] wrote:
> Robert Kern wrote:
> > Sébastien Boisgérault wrote:
> >
> > > By the way, I tried numpy 0.9.4 10 minutes ago and guess
> > > what ? 'eigenvalue' is broken too ... (hangs forever)
> >
> > On what platform? Are you linking against an optimized BLAS? We can't fix
> > anything without details. I'll be happy to work with you on this bug over 
> > on the
> > numpy-discussion list.
>
> This is a guess, but the original poster is probably using one of the
> newer (3.4.x or 4.0.x) versions of gcc. This is a known problem:
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=138791
> (that's one of the applicable bug reports).
>
> A workaround to this problem is to add the option '-ffloat-store' to
> your CFLAGS.

Great ! It works :)
Thank you greg !

SB

> 
> 
> -greg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-23 Thread Sébastien Boisgérault

Robert Kern wrote:
> Sébastien Boisgérault wrote:
> > Robert Kern wrote:
> >
> >>Sébastien Boisgérault wrote:
> >>
> >>>By the way, I tried numpy 0.9.4 10 minutes ago and guess
> >>>what ? 'eigenvalue' is broken too ... (hangs forever)
> >>
> >>On what platform?
> >
> > Linux, Mandriva 2006 (gcc 4.0.1, etc.)
>
> Okay, my answer then is, "Don't use gcc 4." gcc 4 broke enough other projects
> that I don't feel too bad about saying that.

You certainly should not feel bad about that. Matlab does not support
anything
more recent than gcc 3.3 -- and specifically Simulink S-Functions do
not work
when compiled with gcc 3.4.x or 4.0.x.

> In the meantime, can you try the
> workaround that Greg Landrum suggested?

I tried it, it works :)

> Also, we are using Trac now to manage numpy, so please submit tickets here:

ok.

>   http://projects.scipy.org/scipy/numpy/
>
> Thanks!
>
> --
> Robert Kern
> [EMAIL PROTECTED]
>
> "In the fields of hell where the grass grows high
>  Are the graves of dreams allowed to die."
>   -- Richard Harter

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiple inheritance

2006-02-15 Thread Sébastien Boisgérault

Thomas Girod a écrit :

> Hi.
>
> I think I'm missing something about multiple inheritance in python.
>
> I've got this code.
>
> class Foo:
> def __init__(self):
> self.x = "defined by foo"
> self.foo = None
>
> class Bar:
> def __init__(self):
> self.x = "defined by bar"
> self.bar = None
>
> class Foobar(Foo,Bar):
> pass
>
> fb = Foobar()
> print fb.x
> print fb.__dict__
>
> which returns :
>
> >>>
> defined by foo
> {'x': 'defined by foo', 'foo': None}
>
> So I guess not defining __init__ in my class Foobar will call __init__
> from my superclass Foo. Also __dict__ doesn't show an attribute
> 'bar':None so I guess Bar.__init__ is not called at all.
>
> I would like to have a subclass with all attributes from superclasses
> defined, and only the attribute from the first when there is conflict
> (i.e. in this case, Foobar would be like this but with bar:None)
>
> I tried this :
>
> class Foobar(Foo,Bar):
> def __init__(self):
> Foo.__init__(self)
> Bar.__init__(self)
>
> >>>
> defined by bar
> {'x': 'defined by bar', 'foo': None, 'bar': None}
>
> Here I have all I want, except the value of 'x' comes from the 'Bar'
> superclass rather than Foo. So, to have what I want, I would have to
> invert the two calls to __init__ in order to have the right x value.
>
> What I find awkward here is that the order of __init__ calls matters,
> rather than the order of the classes in the class declaration.
>
> Do you have any ideas of a way to get this multiple inheritance thing
> solved without having to do those __init__ calls ?

try:

class Foo(object):
def __init__(self):
super(Foo, self).__init__() # not really necessary here
self.x = "defined by foo"

class Bar(object):
def __init__(self):
super(Bar, self).__init__()
self.x = "defined by bar"

class FooBar(Foo, Bar):
def __init__(self):
super(FooBar, self).__init__()


and search for the "cooperative methods and super" section
in http://www.python.org/2.2/descrintro.html

Cheers,

SB


> 
> Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: doctest's ELLIPSIS

2005-05-02 Thread Sébastien Boisgérault
(Forwarded from Python bug tracker)

[ 1192554 ] doctest's ELLIPSIS and multiline statements

Tim Peters:
[...]
doctest has few syntax requirements, but the
inability to start an expected output block with "..." has
always been one of them, and is independent of the
ELLIPSIS gimmick.  I doubt this will change, in part because
the complications needed to "do something about it" are
probably pig ugly, in part because it's so rare a desire, and
in part because there are easy ways to work around it (like
arranging for the expected output to start with something
other than '...').

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Documenting Python code.

2005-05-03 Thread Sébastien Boisgérault

Have a look at Epydoc (http://epydoc.sourceforge.net/), a documentation
system
that generates HTML and PDF docs. Plain text, Javadoc,
ReStructuredText,
and Epytext docstrings are handled gracefully.

ReStructuredText (or a suitable subset of RST) is probably the best
choice IMHO.

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About Encapsulation

2005-05-04 Thread Sébastien Boisgérault
You mean private, protected, public, that kind of stuff ?

They do not exist in Python. Conventionally if you don't want
the user of a class to access a method or attribute, you use
the prefix _ ;

class K(object):

_a = 1

def __init__(self, val):
self.arg = val
self._hidden = 1

def _method(self):
pass


The _hidden attribute can still be accessed by ...

>>> h = K()._hidden

... but hey ! You know you *should* not. It's the
"we are all consenting adults" philosophy of
programming.

By the way, K._method and K._a won't appear
in the (py-)doc of the class ...

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: descriptor dilemma

2005-05-04 Thread Sébastien Boisgérault

Yup ?!? Weird ... especially as:

>>> id(c.f) == id(C.__dict__['f'].__get__(c,C))
True

I was pretty sure that 'id(a) == id(b)' iff 'a is b' ...

I thought initially that you had two *copies* of the
same method bot obviously it's not true ...

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: descriptor dilemma

2005-05-04 Thread Sébastien Boisgérault

Jeff Epler wrote:
> > >>> id(c.f) == id(C.__dict__['f'].__get__(c,C))
> > True
>
> Here, c.f is discarded by the time the right-hand-side of == is
> executed.  So the object whose id() is being calculated on the
> right-hand-side could turn out to be the same, since the two objects
> have disjoint lifetimes.

Understood. I guess I was influenced by C++ where a temporary survives
up to the end of the complete statement in which it was created. Right
?

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Does anybody know the status of PyCon recordings?

2005-05-09 Thread Sébastien Boisgérault
http://www.pycon.org/talks/

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Importing modules

2005-05-11 Thread Sébastien Boisgérault

[EMAIL PROTECTED] wrote:
[...]
> In some cases there is a further complication: module importing
through
> an indirect mechanism, like: exec "from " + xxx + " import *".

Don't do that. Please ;). If you need too import some modules based
on the module name, stored in a string, consider the using __import__
(http://www.python.org/doc/2.4/lib/built-in-funcs.html). It's a bit
tricky but you may define your own help functions on top of it.

> A part the fact that I have not understood the "real" difference
> between import and from ... import (or also from... import *),


>>> a = exp(1.0) # does not work

>>> import math
>>> e = math.exp(1.0)# works
>>> e = exp(1.0) # does not work

>>> from math import exp
>>> e = exp(1.0) # works

>>> from math import *
>>> e = exp(1.0)  # works
>>> o = sqrt(1.0) # works too

> is it
> possible to re-build the application in only one chunck?
> This is only to better understand the application's structure, in
order
> to implement a flow chart tool.

uh ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Documentation (should be better?)

2005-05-11 Thread Sébastien Boisgérault
Christopher J. Bottaro wrote:
> [...]
> Funny, the con of Python (documentation) is PHP's strong point.
> The PHP manual is extremely easy to navigate and its search feature
> works great. Contrast that with Python, where you have to use "the
> tutorial" as the manual.  Also, the tutorial is just that...a
tutorial,
> its a NOT a manual.

The tutorial is great IMHO and yes, it is definitely not a
reference guide. But what's wrong with the online library
reference or its pdf equivalent ? And why don't you use the
python.org "search" (top right of the screen) ?

> Now for the real kicker.  Some of the module documentation doesn't
> even list simple use cases or even the entire API.

Sometimes the 'missing' interface is (superficially) hidden
on purpose. Example in doctest about the DocTestCase class
(quoted from the library ref) :

"""
Under the covers, DocTestSuite() creates a unittest.TestSuite out of
doctest.DocTestCase instances, and DocTestCase is a subclass of
unittest.TestCase. DocTestCase isn't documented here (it's an internal
detail), but studying its code can answer questions about the exact
details of unittest integration.
"""

Could you be more specific about the modules/packages
that lack proper examples/documentation ?

> When my coworker came to me with
> this complaint, my response was "oh, just load the interpreter,
> import the module and call dir() on it.  Then instantiate some
objects
> and call dir() on them also".  My infatuation with Python had kept me

> from realizing the sheer ridiculousness of that method to learn to
> use an API.  Needless to say, my coworker's reaction to that
statement
> snapped me out of it.  But its the truth.  How many of you learn a
> module by starting the interpreter
> and "playing" around with it and using dir()?

You may also use "help" instead of "dir", or directly
pydoc in a shell:

python>>> help("math")
python>>> help(math) # if 'math' has already been imported
bash$ pydoc math

This kind of documentation system suits me (it is far better
than a raw dir anyway). It supports a 'dotted reference'
description of the path to the objects (ie
package.subpackage.module.holder.object) that is IMHO very
convenient.

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


optparse

2005-05-11 Thread Sébastien Boisgérault

Any idea why the 'options' object in

# optparse stuff
(options, args) = parser.parse_args()

is not/couldn't be a real dict ? Or why at least it
does not support dict's usual methods ?

The next move after a parse_args is often to call
a method 'do_stuff' with the args and options and
I'd like to use a call such as:

do_stuff(args, **options)

This function signature is handy if you also need
sometimes to call 'do_stuff' from the Python interpreter.

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Documentation (should be better?)

2005-05-11 Thread Sébastien Boisgérault

"Manual" == scope of the *Lib Reference* + informal style of the
*Tutorial*,

Right ?

Consider non-official manuals such as:
+ http://diveintopython.org/toc/index.html (free)
+ python in a nutshell
+ python cookbook
+ etc. 

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Documentation (should be better?)

2005-05-11 Thread Sébastien Boisgérault

Christopher J. Bottaro wrote:

> [...]

> Cuz I think the Language Reference is really more of a grammer
reference and
> far too technical to look up simple things like "how to declare a
> function".
>
> I guess what I'm trying to say is that there is no manual (for the
language
> itself, not the modules).  There is just the tutorial that serves as
the
> manual.  I think it should evolve into a manual that is more
comprehensive
> and organized more like other programming manuals (chapter on control
> structures, functions, classes, inheritance, etc).

Fair enough. An 'upgraded' tutorial that would include simple
discussion on some 'advanced topics' could be helpful. For example,
there is (almost) no reference to the new-style classes inside the
tutorial, the "yield" keyword and generator stuff is described in
half a page, etc. 

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: optparse

2005-05-11 Thread Sébastien Boisgérault

Steven Bethard wrote:
> Sébastien Boisgérault wrote:
> > Any idea why the 'options' object in
> >
> > # optparse stuff
> > (options, args) = parser.parse_args()
> >
> > is not/couldn't be a real dict ? Or why at least it
> > does not support dict's usual methods ?
>
> Well, it's not a real dict because the original API intends it to be
> used as object attributes.

Sure ;). But what are the pros of this choice ? The option __str__
mimicks the behavior of a dict. Why not a full interface support
of it ?

> However, if you need a dict, it's pretty
> simple -- use vars() or .__dict__:

Agreed. 100%.

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Documentation (should be better?)

2005-05-11 Thread Sébastien Boisgérault

> I can usually end up where I want to be by picking up my copy of
_Python
> in a Nutshell_.  95% of the time I can find what I want in there or
from
> there.

This book is really great. Could anybody convince Alex Martelli to
basically make it freely available to the world ? <0.9 wink>.

I would gladly pay the price of the book to make it free !

... just dreamin' ...

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dynamic doctests?

2005-05-13 Thread Sébastien Boisgérault

>
>   code='"""\n>>> n\n6\n"""\nn=6\nimport doctest\ndoctest.testmod()'
>   exec(code)
>

Remove 'doctest.tesmod()' and the import from your 'code' string.

]]] exec(code)
]]] import doctest
]]] doctest.testmod()

should do the trick.

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 80 bit precision ?

2005-05-13 Thread Sébastien Boisgérault

Not in the core language or the std library.

However, if you are insterested in high-precision
computations, gmpy may be useful:

http://sourceforge.net/projects/gmpy/

To be honest, I have never used it ;). A review
would be appreciated.

Regards,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 80 bit precision ?

2005-05-14 Thread Sébastien Boisgérault
Terry Reedy a écrit :
> [...]
> Last I read, in CPython, the float type encapsulates a C double.
> So, does any C compiler implements doubles as 80 bit floats?

I seriously doubt it.

> Or, if it has 64 bit
> doubles and 80 bit long doubles, are the latter transparently
> substitutible for the former, so that you could change Python's
> float declaration and have everything work as expected?  (I an
> not sure of either.)

Mm ... the python C code implementing the math module is
probably not that polymorphic . Even a call to "sqrt"
does not work as expected if the argument is a long double.
"sqrtl" should be use instead.

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: NaN support etc.

2005-05-18 Thread Sébastien Boisgérault

Search for:
   + fpconst / PEP 754
   + Tim Peters IEEE 754 accident

"""what-the-world-needs-now-is-nannanny.py-ly y'rs""  - SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: NaN support etc.

2005-05-18 Thread Sébastien Boisgérault

Martin v. Löwis a écrit :
> Andreas Beyer wrote:
> > How do I find out if NaN, infinity and alike is supported on the
current
> > python platform?
>
> To rephrase Sebastian's (correct) answer: by
>
> 1. studying the documentation of the CPU vendor
> 2. studying the documentation of the compiler vendor, and performing
>extensive tests on how the compiler deals with IEEE-754
> 3. studying the documentation of the system's C library, reading
>its source code (if available), and performing extensive tests
>of the IEEE-754 support in the C libray
> 4. studying Python's source code (you can spare yourself reading
>documentation because there is none)

That's the theory. Granted, the floating point special
values handling may vary widely across platforms. The
fact that

float('nan') == float('nan')

may be False (correct) for my Python 2.4 interpreter
(Linux Mandrake 10.x, compiled from the sources) and
True (too bad ..) for my Python 2.3 interpreter (rpm)
for the SAME operating system and computer is rather
unsettling ... at first.

But, practically, I have never found a platform where
the following fpconst-like code did not work:

import struct
cast = struct.pack

big_endian = cast('i',1)[0] != '\x01'
if big_endian:
   nan = cast('d', '\x7F\xF8\x00\x00\x00\x00\x00\x00')[0]
else:
   nan = cast('d', '\x00\x00\x00\x00\x00\x00\xf8\xff')[0]

Can anybody provide an example of a (not too old or
exotic) platform where this code does not behave as
expected ?

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


embedded Python

2005-05-25 Thread Sébastien Ramage
bonjour,

après bien du mal j'ai réussi à créer une dll pour 4e Dimension

maintenant j'aurai voulu intégré Python à cette dll
j'ai voulu faire simple pour le moment en utilisant l'exemple donné
dans la doc

exemple :
#include 

int
main(int argc, char *argv[])
{
  Py_Initialize();
  PyRun_SimpleString("from time import time,ctime\n"
 "print 'Today is',ctime(time())\n");
  Py_Finalize();
  return 0;

}

mais au moment du linkage j'obtient les erreurs suivantes :
Package.obj : error LNK2001: unresolved external symbol
[EMAIL PROTECTED]
Package.obj : error LNK2001: unresolved external symbol
[EMAIL PROTECTED]
Package.obj : error LNK2001: unresolved external symbol
[EMAIL PROTECTED]

Pourtant l'exemple fonctionne, j'ai essayé.
quel différence alors avec ma dll ?

comment utilisé Python sous forme d'une dll ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: embedded Python

2005-05-25 Thread Sébastien Ramage
PROBLEME RESOLU

j'ai résolu le problème en supprimant le commutateur \GZ de le link
http://support.microsoft.com/kb/q191669/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lambda a plusieurs arguments

2005-05-27 Thread Sébastien Boisgérault
Nico,

[EMAIL PROTECTED] seems to be a good place to post
questions related to Python if you intend to use
french.

-> http://www.aful.org/wws/arc/python/

((
des questions rédigées en français sont plus
à leur place sur des liste de diffusions
nationales ...
))

Regards,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ControlDesk Automation in dSpace

2005-05-29 Thread Sébastien Boisgérault
Crispen a écrit :
> I am having trouble using the ControlDesk automation libraries in
> python. In particluiar running the automation in a thread. My code is
> as follows, is keeps coming up with this strange error. Any help would
> be great.
>
> Crispen
>
> import cdacon
> from time import sleep
> from cdautomationlib import *
>
> def Auto():
> [... skip ...]
> thread.start_new_thread(Auto,())

Crispen,

I am afraid that you won't find many dspace users on
comp.lang.python. The code you produced is quite hard
to read, we lack some info about the context of your
app and you didn't provide what the error you encounter
is ...

Maybe you should provide a minimal python code that
does not work, and give us the corresponding error
message.

If it is Python related, I guess that you'll probably
get a reply. If it is related to dspace, maybe you
should try comp.soft-sys.matlab (?), or any other group
that may discuss dspace issues.

Regards,

Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Trying to understand pickle.loads withou class declaration

2005-05-29 Thread Sébastien Boisgérault
Even

class A:
pass

should do the trick. Only the instance attributes are saved by a
pickle,
not the methods or the class itself. The unpickler tries to merge the
saved data and the class/method info that is not saved to recreate
the fully functional instance... but of course this info should still
be available. The unpickler will even import the class from the
appropriate module if necessary.

If you want your unpickler to manufacture a class for you when
it is not available, you may use the gnosis xml pickler with the
appropriate security ("paranoia") level.

http://gnosis.cx/download/gnosis/xml/pickle/

Cheers,

Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Newbee question : List of packages

2005-06-01 Thread Sébastien V.
Hello,

I'm quite new in Python and I discover every day very interesting new
packages in this newsgroup : Is there somewhere on the web a list (as
complete as possible) in which main features of external packages are listed
?

Sebastien


-- 
http://mail.python.org/mailman/listinfo/python-list


Sybase module 0.38 released

2007-05-03 Thread Sébastien Sablé

WHAT IS IT:

The Sybase module provides a Python interface to the Sybase relational
database system.  It supports all of the Python Database API, version
2.0 with extensions.

The module is available here:

http://downloads.sourceforge.net/python-sybase/python-sybase-0.38.tar.gz

The module home page is here:

http://python-sybase.sourceforge.net/


CHANGES SINCE 0.38pre2:

* Corrected bug in databuf_alloc: Sybase reports the wrong maxlength
for numeric type - verified with Sybase 12.5 - thanks to patch
provided by Phil Porter


MAJOR CHANGES SINCE 0.37:

* This release works with python 2.5

* It also works with sybase 15

* It works with 64bits clients

* It can be configured to return native python datetime objects

* The bug "This routine cannot be called because another command
structure has results pending." which appears in various cases has
been corrected

* It includes a unitary test suite based on the dbapi2.0 compliance
test suite
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: searching algorithm

2007-05-10 Thread Sébastien Ramage
I have made a script that search anagram based on the ODS file ( call
OSW in english, Official Scrabble Words)
it load a file that contain 369085 words (one word per line)

I create a dictionnary and store word into using the length of the
word as key
example : mydict[2] contain a list of word with length = 2

first I select the correct dict entry and in a second time I scan this
list searching correct word

my file contains 369085 and it's pretty fast

Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-17 Thread Sébastien Buchoux
beginner a écrit :
> Hi All.
>
> I'd like to do the following in more succint code:
>
> if k in b:
> a=b[k]
> else:
> a={}
> b[k]=a
>
> a['A']=1
>
>
> In perl it is just one line: $a=$b->{"A"} ||={}.
>
> Thanks,
> Geoffrey
>
>   
One solution I often use in such cases:

try:
a = b[k]
except KeyError: #or except IndexError: if b is a list/tuple and not a dict
a = {}
b[k] = a

a['A'] = 1

Indeed, exceptions are handled faster than "if/else" loops. As it was 
mentionned earlier, One neat solution in Perl may not be the perfect one 
in Python.

Cheers,

Sébastien
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hot subject: a good python editor and/or IDE?

2007-08-19 Thread Buchoux Sébastien
Bjoern Schliessmann wrote:
> Sébastien wrote:
>   
>> I am currently using Eclipse+PyDev when developping Python
>> projects but I lack a fast, simple editor for tiny bit of scripts.
>> So here is my question: what is, for you, the current best ( but
>> still kind of light! ) Python editor/IDE ?
>> 
>
> vim
>
> BTW, this is an FAQ. Please look through the archives for many
> threads with many, many IDEs.
>
> Regards,
>
>
> Björn
>
>   
Yeah, I know this is a FAQ, but, as you mention, there is a whole bunch 
of editors, every one of them being updated constantly (+ the new ones 
getting out). So I am quite sure that looking through the archives is 
THE solution since it will only reflect what people thought when 
question was asked. Just type "best Python editor" on Google and you 
will see that almost all hits are completely out of date.
Fair enough though! ;)
-- 
http://mail.python.org/mailman/listinfo/python-list


SAMBA-PYTHON ???

2007-03-04 Thread WEBER Sébastien
Hello,

(I'm french and I speak english like a spanish cow : sorry.)

Does someone know how to use the samba-python tdb.so module ? I've been
looking for information about this on Google for 3 days and I've found not
a word. The only functions I can use are 'open()' and 'first_key()' : not
enough.

Thank's.

SW.
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >