Interpreting string containing \u000a

2008-06-18 Thread Francis Girard
Hi, I have an ISO-8859-1 file containing things like Hello\u000d\u000aWorld, i.e. the character '\', followed by the character 'u' and then '0', etc. What is the easiest way to automatically translate these codes into unicode characters ? Thank you Francis Girard -- http://mail.python.org

Re: Interpreting string containing \u000a

2008-06-18 Thread Francis Girard
Thank you very much ! I didn't know about this 'unicode-escape'. That's great! Francis 2008/6/18 Duncan Booth [EMAIL PROTECTED]: Francis Girard [EMAIL PROTECTED] wrote: I have an ISO-8859-1 file containing things like Hello\u000d\u000aWorld, i.e. the character '\', followed

Re: Looking for lots of words in lots of files

2008-06-18 Thread Francis Girard
is a great book to read) Regards Francis Girard 2008/6/18 brad [EMAIL PROTECTED]: Just wondering if anyone has ever solved this efficiently... not looking for specific solutions tho... just ideas. I have one thousand words and one thousand files. I need to read the files to see if some

Re: Software for Poets (Was: Re: Text-to-speech)

2005-03-21 Thread Francis Girard
This is about poetry. I think the next reply should be done privately unless someone else is interested in it. Hi, Le dimanche 20 Mars 2005 23:04, Paul Rubin a écrit : Francis Girard [EMAIL PROTECTED] writes: 4- Propose a synonym that will fit in a verse, i.e. with the right amount

Re: Pre-PEP: Dictionary accumulator methods

2005-03-20 Thread Francis Girard
= {subkey:value} else: d[key][subkey] = value Much better than adding special cases on a generic class. Special cases always demultiply and if we open the door Regards, Francis Girard Le samedi 19 Mars 2005 02:24, Raymond Hettinger a crit: I would like to get everyone's

Software for Poets (Was: Re: Text-to-speech)

2005-03-20 Thread Francis Girard
translate the text into phonems. Right ? Do you know if there some way that I can re-use some sub-modules from these projects that will translate text into phonems ? Regards, Francis Girard Le dimanche 20 Mars 2005 04:40, Charles Hartman a écrit : Does anyone know of a cross-platform (OSX

Re: Unicode BOM marks

2005-03-08 Thread Francis Girard
Francis Girard -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode BOM marks

2005-03-08 Thread Francis Girard
Hi, Thank you for your answer. That confirms what Martin v. Lwis says. You can choose between UCS-2 or UCS-4 for internal unicode representation. Francis Girard Le mardi 8 Mars 2005 00:44, Jeff Epler a crit: On Mon, Mar 07, 2005 at 11:56:57PM +0100, Francis Girard wrote: BTW, the python

Unicode BOM marks

2005-03-07 Thread Francis Girard
specifying the encoding ? Thank you Francis Girard Python tells me to use an encoding declaration at the top of my files (the message is referring to http://www.python.org/peps/pep-0263.html). I expected to see there a list of acceptable -- http://mail.python.org/mailman/listinfo/python

Re: Unicode BOM marks

2005-03-07 Thread Francis Girard
sincere thanks, Francis Girard Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: yield_all needed in Python

2005-03-02 Thread Francis Girard
Le mercredi 2 Mars 2005 21:32, Skip Montanaro a écrit : def f():     yield from (x for x in gen1(arg)) Skip This suggestion had been made in a previous posting and it has my preference : def f(): yield from gen1(arg) Regards Francis --

Re: yield_all needed in Python

2005-03-01 Thread Francis Girard
I return the sub-iterator itself and let the final upper loop do the job ? But no, I absolutely have to 'yield'. What then ? Therefore, the suggestion you make, or something similar, would have actually ease my learning, at least for me. Regards, Francis Girard Le mardi 1 Mars 2005 19:22

Re: Module RE, Have a couple questions

2005-03-01 Thread Francis Girard
) and file iterator, you can scan files as big as you want with very little memory usage. Regards, Francis Girard -- http://mail.python.org/mailman/listinfo/python-list

Re: Module RE, Have a couple questions

2005-03-01 Thread Francis Girard
Hi, Le mardi 1 Mars 2005 22:15, [EMAIL PROTECTED] a écrit : Now I don't know this stuff very well but I dont think the code [line for line in document if (line.find('word') != -1 \         and line.find('wordtwo') != -1)] would do this as it answers the question in how you thought I

Re: yield_all needed in Python

2005-03-01 Thread Francis Girard
Hi, No, this won't do. What is needed is a way to yield the results of a generator from inside another generator with having to do a for-yield-loop inside the outter generator. Regards, Francis Girard Le mardi 1 Mars 2005 22:35, Adam Przybyla a crit: ... mayby that way: ython 2.2.3 (#1

Re: yield_all needed in Python

2005-03-01 Thread Francis Girard
Oops. I meant without having instead of with having which is a syntax error. Regards Le mardi 1 Mars 2005 22:53, Francis Girard a crit: No, this won't do. What is needed is a way to yield the results of a generator from inside another generator with having to do a for-yield-loop inside

Re: Splitting strings - by iterators?

2005-02-25 Thread Francis Girard
() === END SNAP Regards, Francis Girard Le vendredi 25 Février 2005 16:55, Jeremy Sanders a écrit : I have a large string containing lines of text separated by '\n'. I'm currently using text.splitlines(True) to break the text into lines, and I'm iterating over the resulting list. This is very slow

Re: Iterator / Iteratable confusion

2005-02-15 Thread Francis Girard
Le mardi 15 Fvrier 2005 02:26, Terry Reedy a crit: Francis Girard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] (Note for oldtimer nitpickers: except where relevant, I intentionally ignore the old and now mostly obsolete pseudo-__getitem__-based iteration protocol here

Re: Iterator / Iteratable confusion

2005-02-14 Thread Francis Girard
acceptable. Regards, PS : I am carefully reading Micheal Spencer very interesting reply. Thank you, Francis Girard -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help

2005-02-14 Thread Francis Girard
Mmm. This very much look like a homework from school. Right ? Francis Girard Le lundi 14 Février 2005 04:03, Chad Everett a écrit : Hey guys, Hope you can help me again with another problem. I am trying to learn Python on my own and need some help with the following. I am writing a program

Re: Commerical graphing packages?

2005-02-14 Thread Francis Girard
for taking the time to read my post! :) It's worth checking out matplotlib as well although it may not meet all your criteria ... but have a look, its a great package PyX might also be interesting, depending on your needs. Regards Francis Girard -- http://mail.python.org/mailman/listinfo/python

Re: Newbie help

2005-02-14 Thread Francis Girard
to find your bugs that way. It sometimes help to suffer a little. But, of course, I think you will always find an helping hand if needed. Regards Francis Girard Le lundi 14 Fvrier 2005 21:58, Chad Everett a crit: Nope, I am trying to learn it on my own. I am using the book by Michael Dawson

Re: Alternative to raw_input ?

2005-02-13 Thread Francis Girard
Le vendredi 11 Février 2005 18:00, den a écrit : import msvcrt msvcrt.getch() I frequently had the problem to have something similar but *portable*. Something as short and simple. Someone have an idea ? Thank you Francis Girard -- http://mail.python.org/mailman/listinfo/python-list

Re: A great Alan Kay quote

2005-02-13 Thread Francis Girard
Le vendredi 11 Fvrier 2005 21:45, Curt a crit: On 2005-02-10, Francis Girard [EMAIL PROTECTED] wrote: I think I've been enthouasistic too fast. While reading the article I grew more and more uncomfortable with sayings like : snip Yes, you may have grown uncomfortable because what you read

Re: check if object is number

2005-02-13 Thread Francis Girard
an exception.  As Fredrik Lundh pointed out, they could, if they wanted to, also rip out the code that special-cases None too. Steve Regards Francis Girard -- http://mail.python.org/mailman/listinfo/python-list

Iterator / Iteratable confusion

2005-02-13 Thread Francis Girard
about it ? Regards Francis Girard BEGINNING OF EXAMPLES from itertools import tee, imap, izip, islice import sys import traceback sEx1Doc = \ Example 1

Re: A great Alan Kay quote

2005-02-13 Thread Francis Girard
Le dimanche 13 Février 2005 19:05, Arthur a écrit : On Sun, 13 Feb 2005 18:48:03 +0100, Francis Girard My deepest apologies, Francis Girard Sorry if I helped get you into this, Francis. No, no, don't worry. I really expressed my own opinions and feelings. At the same time, I certainly

Re: A great Alan Kay quote

2005-02-10 Thread Francis Girard
Le jeudi 10 Février 2005 04:37, Arthur a écrit : On Wed, 9 Feb 2005 21:23:06 +0100, Francis Girard [EMAIL PROTECTED] wrote: I love him. I don't. It's also interesting to see GUIs with windows, mouse (etc.), which apparently find their origin in is mind, probably comes from the desire

Re: A great Alan Kay quote

2005-02-10 Thread Francis Girard
Thank you. Francis Girard Le jeudi 10 Fvrier 2005 02:48, Scott David Daniels a crit: Francis Girard wrote: ... It's also interesting to see GUIs with windows, mouse (etc.), which apparently find their origin in is mind, probably comes from the desire to introduce computers to children

Re: A great Alan Kay quote

2005-02-10 Thread Francis Girard
Le jeudi 10 Février 2005 19:47, PA a écrit : On Feb 10, 2005, at 19:43, Francis Girard wrote: I think he's a bit nostalgic. Steve Wart about why Smalltalk never caught on: http://hoho.dyndns.org/~holger/smalltalk.html Cheers -- PA, Onnay Equitursay http://alt.textdrive.com

Re: convert list of tuples into several lists

2005-02-09 Thread Francis Girard
, 5, 6]] Anyway, I find Diez solution brillant ! I'm always amazed to see how skilled a programmer can get when comes the time to find a short and sweet solution. One can admire that zip(*zip(*a_list_of_tuples)) == a_list_of_tuples Thank you You gave me much to enjoy Francis girard -- http

Re: A great Alan Kay quote

2005-02-09 Thread Francis Girard
, probably comes from the desire to introduce computers to children. Francis Girard Le mercredi 9 Fvrier 2005 20:29, Grant Edwards a crit: On 2005-02-09, James [EMAIL PROTECTED] wrote: Surely Perl is another example of filling a tiny, short-term need, and then being a real problem

Re: After 40 years ... Knuth vol 4 is to be published!!

2005-02-07 Thread Francis Girard
I think that Led Zeppelin, Pink Floyd and the Beatles (this time with John Lennon back from the cemetry) also made a come back. Addison-Wesley decided to preprint a photo of the messiah (just for us!) Yippee! Francis Girard Le samedi 5 Fvrier 2005 13:39, Laura Creighton a crit: More than

Re: Collapsing a list into a list of changes

2005-02-07 Thread Francis Girard
the functions that apply another function to each and every elements of a list are bad (like reduce, map, filter) ? Francis Girard Le lundi 7 Février 2005 19:25, Steven Bethard a écrit : Francis Girard wrote: I'm very sorry that there is no good use case for the reduce function in Python, like

Re: Collapsing a list into a list of changes

2005-02-07 Thread Francis Girard
Le lundi 7 Fvrier 2005 19:51, John Lenton a crit: On Mon, Feb 07, 2005 at 07:07:10PM +0100, Francis Girard wrote: Zut ! I'm very sorry that there is no good use case for the reduce function in Python, like Peter Otten pretends. That's an otherwise very useful tool for many use cases

Re: Collapsing a list into a list of changes

2005-02-07 Thread Francis Girard
Le lundi 7 Février 2005 20:30, Steven Bethard a écrit : Francis Girard wrote: Is there someone on this list using this tool and happy with it ? Or is my mind too much targeted on FP paradigm and most of you really think that all the functions that apply another function to each and every

Re: Collapsing a list into a list of changes

2005-02-07 Thread Francis Girard
Le lundi 7 Février 2005 21:21, Steven Bethard a écrit : Francis Girard wrote: Le lundi 7 Février 2005 20:30, Steven Bethard a écrit : especially since I avoid lambda usage, and would have to write these as: Why avoid lambda usage ? You find them too difficult to read (I mean in general

Re: Collapsing a list into a list of changes

2005-02-07 Thread Francis Girard
Le lundi 7 Février 2005 22:53, Steven Bethard a écrit : Francis Girard wrote: I see. I personnaly use them frequently to bind an argument of a function with some fixed value. Modifying one of the example in http://mail.python.org/pipermail/python-list/2004-December/257990.html I

Re: WYSIWYG wxPython IDE....?

2005-02-07 Thread Francis Girard
minutes, and it's layout is just how I want it! Exactly the same for me. Qt is just a pure marvel. I hope this will not kill wx though. We need diversity. It might very well be that wx gpl on windows was one of the factor that made Troll decide to do the same with Qt. Francis Girard -- http

Re: remove duplicates from list *preserving order*

2005-02-06 Thread Francis Girard
, other than rolling your sleeves and code your own data structure in Python, which would be slowlier than the provided dict or set C implementation. I think this a hole into the Pythin libs. Regards Francis Girard Le jeudi 3 Février 2005 21:39, Steven Bethard a écrit : I'm sorry, I assume

Re: returning True, False or None

2005-02-06 Thread Francis Girard
I think it is evil to do something at your own risk ; I will certainly not embark some roller coaster at my own risk. I also think it is evil to scan the whole list (as max ought to do) when only scanning the first few elements would suffice most of the time. Regards Francis Girard Le

Re: Collapsing a list into a list of changes

2005-02-06 Thread Francis Girard
(lambda v,e: v[-1]!=e and v+[e] or v, lst[1:], [lst[0]]) or [] print straightforward_collapse(a_lst) print straightforward_collapse_secu([]) --END SNAP Regards Francis Girard Le vendredi 4 Février 2005 20:08, Steven Bethard a écrit : Mike C. Fletcher wrote: Alan McIntyre wrote: ... I

Re: string issue

2005-02-06 Thread Francis Girard
Yes, I also this that comprehension is the clearer way to handle this. You might also consider the good old filter function : ips = filter(lambda ip: '255' not in ip, ips) Francis Girard Le vendredi 4 Février 2005 20:38, rbt a écrit : Thanks guys... list comprehension it is! Bill Mill wrote

Re: Next step after pychecker

2005-02-02 Thread Francis Girard
blend Pyrex. I am not sure what it exactly means and how they plan to face the problems we foresee. Francis Girard -- http://mail.python.org/mailman/listinfo/python-list

Re: Next step after pychecker

2005-02-02 Thread Francis Girard
. Such expression have _no_ value: they are simply regarded as illegal. But Skip, I am sure that you can easily find an example by yourself. For example, replace + by a function that does different things depending on its argument type. Francis Girard Le mercredi 2 Février 2005 10:27, Philippe Fremy a écrit

Re: Next step after pychecker

2005-02-01 Thread Francis Girard
design. It would certainly be valuable to attempt the experience, and rename the new language (mangoose would be a pretty name). Francis Girard FRANCE Le mardi 1 Février 2005 16:49, Diez B. Roggisch a écrit : But it can be useful to restrict type variety in certain situations e.g. prime

Re: Next step after pychecker [StarKiller?]

2005-02-01 Thread Francis Girard
Hi, Do you have some more pointers to the StarKiller project ? According to the paper some implementation of this very interesting project exists. Thank you Francis Girard Le mardi 1 Février 2005 11:21, Sylvain Thenault a écrit : On Tue, 01 Feb 2005 05:18:12 +0100, Philippe Fremy wrote

Re: Classical FP problem in python : Hamming problem

2005-01-28 Thread Francis Girard
Le vendredi 28 Janvier 2005 08:27, Paul Rubin a écrit : Francis Girard [EMAIL PROTECTED] writes: Thank you Nick and Steven for the idea of a more generic imerge. If you want to get fancy, the merge should use a priority queue (like in the heapsort algorithm) instead of a linear scan through

Re: Question about 'None'

2005-01-28 Thread Francis Girard
Le vendredi 28 Janvier 2005 22:54, jfj a écrit : Francis Girard wrote: What was the goal behind this rule ? If you have a list which contains integers, strings, tuples, lists and dicts and you sort it and print it, it will be easier to detect what you're looking for:) G. Mmm. Certainly

Re: Classical FP problem in python : Hamming problem

2005-01-27 Thread Francis Girard
Le jeudi 27 Janvier 2005 10:30, Nick Craig-Wood a crit: Francis Girard [EMAIL PROTECTED] wrote: Thank you Nick and Steven for the idea of a more generic imerge. You are welcome :-) [It came to me while walking the children to school!] Sometimes fresh air and children purity is all what

Re: Question about 'None'

2005-01-27 Thread Francis Girard
Le jeudi 27 Janvier 2005 20:16, Steven Bethard a écrit : flamesrock wrote: The statement (1 None) is false (or any other value above 0). Why is this? What code are you executing? I don't get this behavior at all: py 100 None True py 1 None True py 0 None True py -1 None True

Re: Question about 'None'

2005-01-27 Thread Francis Girard
Oops, I misunderstood what you said. I understood that it was now the case that objects of different types are not comparable by default whereas you meant it as a planned feature for version 3. I really hope that it will indeed be the case for version 3. Francis Girard Le jeudi 27 Janvier

Re: Question about 'None'

2005-01-27 Thread Francis Girard
Le jeudi 27 Janvier 2005 22:07, Steven Bethard a écrit : Francis Girard wrote: Le jeudi 27 Janvier 2005 21:29, Steven Bethard a écrit : So None being smaller than anything (except itself) is hard-coded into Python's compare routine. My suspicion is that even if/when objects of different

Re: Question about 'None'

2005-01-27 Thread Francis Girard
Very complete explanation. Thank you Francis Girard Le jeudi 27 Janvier 2005 22:15, Steven Bethard a écrit : Francis Girard wrote: I see. There is some rule stating that all the strings are greater than ints and smaller than lists, etc. Yes, that rule being to compare objects of different

Re: python without OO

2005-01-26 Thread Francis Girard
pay big money for these kind of monsters after having seen a few ppt slides about it, it makes me shiver. Regards, Francis Girard FRANCE -- http://mail.python.org/mailman/listinfo/python-list

Re: python without OO

2005-01-26 Thread Francis Girard
too, Francis Girard FRANCE -- PA http://alt.textdrive.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: python without OO

2005-01-26 Thread Francis Girard
Le mercredi 26 Janvier 2005 21:44, PA a écrit : On Jan 26, 2005, at 21:35, Francis Girard wrote: Project fails for many reasons but seldomly because one language is better or worst than another one. I think you're right. But you have to choose the right tools that fit your needs

Re: Classical FP problem in python : Hamming problem

2005-01-26 Thread Francis Girard
Le mardi 25 Janvier 2005 09:01, Michael Spencer a crit: Francis Girard wrote: The following implementation is even more speaking as it makes self-evident and almost mechanical how to translate algorithms that run after their tail from recursion to tee usage : Thanks, Francis and Jeff

Re: Classical FP problem in python : Hamming problem

2005-01-26 Thread Francis Girard
). The merge function to use with hamming() is imerge_inf_nodup. Regards, Francis Girard FRANCE Nick Craig-Wood wrote: Steven Bethard [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: Thinking about this some more leads me to believe a general purpose imerge taking any number of arguments

Re: Another scripting language implemented into Python itself?

2005-01-25 Thread Francis Girard
everywhere from my worst sex web sites ! I'm not really sure why the original poster want to use Python, I think it's to make the glue between C++ and the scripting engine. Nor am I really sure why java runs inside my browser ... Francis Girard FRANCE Le mardi 25 Janvier 2005 18:08, Cameron Laird

Re: Classical FP problem in python : Hamming problem

2005-01-24 Thread Francis Girard
be established. For this family of algorithms, itertools.tee is the way to go. I think that the semi-tutorial in test_generators.py should be updated to use tee. Or, at least, a severe warning comment should be written. Thank you, Francis Girard FRANCE Le dimanche 23 Janvier 2005 23:27, Jeff Epler a crit

Re: Classical FP problem in python : Hamming problem

2005-01-24 Thread Francis Girard
= fibGenerators[1] curAheadGen.next() while True: yield curGen.next() + curAheadGen.next() fibGenerators = tee(_fib(), 3) return fibGenerators[2] for n in fib(): print n, sys.stdout.flush() *** END SNAP Francis Girard FRANCE Le lundi 24 Janvier 2005 14:09, Francis Girard

Re: Classical FP problem in python : Hamming problem

2005-01-24 Thread Francis Girard
Ok I'll submit the patch with the prose pretty soon. Thank you Francis Girard FRANCE Le mardi 25 Janvier 2005 04:29, Tim Peters a écrit : [Francis Girard] For all the algorithms that run after their tail in an FP way, like the Hamming problem, or the Fibonacci sequence, (but unlike Sieve

Classical FP problem in python : Hamming problem

2005-01-23 Thread Francis Girard
the time. At least, I would expect the program to produce much more results before surrending. What's going on ? Thank you Francis Girard FRANCE -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-22 Thread Francis Girard
Le samedi 22 Janvier 2005 10:10, Alex Martelli a crit: Francis Girard [EMAIL PROTECTED] wrote: ... But besides the fact that generators are either produced with the new yield reserved word or by defining the __new__ method in a class definition, I don't know much about them. Having

Re: need help on need help on generator...

2005-01-21 Thread Francis Girard
a comprehensive list of all the lazy constructions built in Python ? (I think that to easily distinguish lazy from strict constructs is an absolute programmer need -- otherwise you always end up wondering when is it that code is actually executed like in Haskell). Thank you Francis Girard FRANCE Le

Re: need help on generator...

2005-01-21 Thread Francis Girard
of consecutive_sets is simply a list, not a generator. I'm just trying to understand and obviously I'm missing the point. Thank you Francis Girard FRANCE -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-21 Thread Francis Girard
path. http://gnosis.cx/publish/programming/metaclass_1.html http://gnosis.cx/publish/programming/metaclass_2.html Thank you, I'll read that. Francis Girard FRANCE Le vendredi 21 Janvier 2005 16:42, Craig Ringer a crit: On Fri, 2005-01-21 at 16:05 +0100, Francis Girard wrote: I

Re: need help on generator...

2005-01-21 Thread Francis Girard
Thank you, I immediately download version 2.4, switching from version 2.3. Francis Girard FRANCE Le vendredi 21 Janvier 2005 17:34, Craig Ringer a crit: On Fri, 2005-01-21 at 16:54 +0100, Francis Girard wrote: First, I think that you mean : consecutive_sets = [ x[offset:offset

Re: Overloading ctor doesn't work?

2005-01-20 Thread Francis Girard
addresses, which of course can't be the same. And that is why your test fails. Consider defining the __cmp__ method (see 2.3.3 Comparisons of the library reference). Sess also the operator module. Francis Girard LANNILIS Breizh FRANCE Le jeudi 20 Janvier 2005 19:23, Martin Häcker a écrit : Hi

Re: Overloading ctor doesn't work?

2005-01-20 Thread Francis Girard
Wow ! Now, this is serious. I tried all sort of things but can't solve the problem. I'm mystified too and forget my last reply. I'm curious to see the answers. Francis Girard Le jeudi 20 Janvier 2005 19:59, Kent Johnson a écrit : Martin Häcker wrote: Hi there, I just tried to run this code