x27;s "Programming Pearls" 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
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
> >
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
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 t
o spoken text must
first 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
For other
> uses, plain Python code suffices in terms of speed, clarity, and avoiding
> unnecessary instantiation of empty containers:
>
> if key not in d:
> d.key = {subkey:value}
> else:
> d[key][subkey] = value
Much better than adding special cases on a
Hi,
Thank you for your answer. That confirms what Martin v. LÃwis 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:
> >
g Python) to internally represent unicode strings as fixed 2 or 4
bytes per characters (UCS).
Thank you
Francis Girard
--
http://mail.python.org/mailman/listinfo/python-list
UTF-32 ?
> > BOM_LE : UTF-8 only or UTF-8 and UTF-32 ?
>
> UTF-16
>
Ok.
> > Why should I need these constants if codecs decoder can handle them
> > without my help, only specifying the encoding ?
>
> Well, because the codecs don't. It might be useful to add a
> "utf-8-signature" codec some day, which generates the signature on
> encoding, and removes it on decoding.
>
Ok.
My sincere thanks,
Francis Girard
> Regards,
> Martin
--
http://mail.python.org/mailman/listinfo/python-list
thout my
help, only 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/mai
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
--
http://mail.python.org/mailman/listinfo/python
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 wit
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:
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
Hi,
This might even be faster since using re.search, we don't need to parse the
whole line.
Regards,
Francis Girard
=== BEGIN SNAP
## rewords.py
import re
import sys
def iWordsMatch(lines, word, word2):
reWordOneTwo = re.compile(r"((%s.*%s)|(%s.*%s))" %
d be detected.
Hi,
A lexer producing a DFA like the one in pyggy (see
http://www.lava.net/~newsham/pyggy/) might be what you're looking for.
Regards,
Francis Girard
--
http://mail.python.org/mailman/listinfo/python-list
sMatch(open("rewords.py"), "re", "return"):
sys.stdout.write(line)
=== End SNAP
Regards,
Francis Girard
--
http://mail.python.org/mailman/listinfo/python-list
snap
Furthermore, using list comprehension generator (2.4 only I think) 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
? Can 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 mar
h well.
"""
for oMatch in reLn.finditer(sStr):
print oMatch.group()
=== 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
Le mardi 15 FÃvrier 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-__getit
earn a lot more trying 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 FÃvrier 2005 21:58, Chad Everett a ÃcritÂ:
> Nope, I am trying to learn it on my own. I am using t
or similar ones. I am particularly interested to hear
> > about any limitations or problems you ran into with whatever package you
> > are using.
> >
> > Thanks for taking the time to read my post! :)
>
> It's worth checking out matplotlib as well although it ma
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.
>
&
s to
slightly modify the way iteration is done. But I think I'm getting a bit too
severe here as I think that the compomise choice made by Python is very
acceptable.
Regards,
PS : I am carefully reading Micheal Spencer very interesting reply.
Thank you,
Francis Girard
--
http://mail.python.org/mailman/listinfo/python-list
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
r feelings about it ?
Regards
Francis Girard
BEGINNING OF EXAMPLES
from itertools import tee, imap, izip, islice
import sys
import traceback
sEx1Doc = \
"""
=
this way, and has suggested that in Python
> 3.0, objects of unequal types will not have a default comparison.
>
> Probably this means ripping the end off of default_3way_compare and
> raising 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
Le vendredi 11 FÃvrier 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 :
>
>
>
> Yes, yo
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
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
>
> C
Thank you.
Francis Girard
Le jeudi 10 FÃvrier 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
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
> > apparent
apparently
find their origin in is mind, probably comes from the desire to introduce
computers to children.
Francis Girard
Le mercredi 9 FÃvrier 2005 20:29, Grant Edwards a ÃcritÂ:
> On 2005-02-09, James <[EMAIL PROTECTED]> wrote:
> > Surely
> >
> > "Perl is anoth
re really wanted :
>>> map(list, zip(*[(1,4),(2,5),(3,6)]))
[[1, 2, 3], [4, 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_tupl
any knowledge of these issues. I
was just wondering if it did happen. Did some law court, over the past
decade, had to make a decision about GPL on some real issue ?
Thank you
Francis Girard
Le mardi 8 Février 2005 05:17, Robert Kern a écrit :
> Grant Edwards wrote:
> > Sorry if
tDesigner in about 5 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
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-Decem
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 fi
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
Le lundi 7 FÃvrier 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. Th
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 go
function in Python and we don't know why we bother you offering it."
Francis Girard
Le lundi 7 Février 2005 08:24, Peter Otten a écrit :
> Francis Girard wrote:
> > This is a prefect use case for the good old "reduce" function:
> >
> > --BEGIN SNAP
&g
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 FÃvrier 2005 13:39, Laura Creighton a ÃcritÂ:
> "M
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 comprehensi
rn lst and reduce(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:
> >
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
to do this in python,
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 :
&
ore evaluation. 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
ing Python into the "smooth 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
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 wr
way, strong typing as defined above would change the Python language in
some of its fundamental 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
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 l
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)
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
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
Le vendredi 28 Janvier 2005 07:49, jfj a écrit :
> Francis Girard wrote:
> > Wow ! What is it that are compared ? I think it's the references (i.e.
> > the adresses) that are compared. The "None" reference may map to the
> > physical 0x0 adress whereas 100 is
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
Le jeudi 27 Janvier 2005 21:29, Steven Bethard a écrit :
> Francis Girard wrote:
> > 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?
&
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
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 ai
be great to have a
notation for this in Python, i.e. binding a function argument to yield a new
function).
The merge function to use with hamming() is imerge_inf_nodup.
Regards,
Francis Girard
FRANCE
> Nick Craig-Wood wrote:
> > Steven Bethard <[EMAIL PROTECTED]> wrote:
> >
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&qu
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'
s what you meant anyway.
>
> Cheers
>
Cheers too,
Francis Girard
FRANCE
> --
> PA
> http://alt.textdrive.com/
--
http://mail.python.org/mailman/listinfo/python-list
he
nightmare derscribed in that discussion thread. When I think that comapnies
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
wsers 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,
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 Fibonacc
curGen = fibGenerators[0]
curAheadGen = 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
gorithms ; and the best way to implement them should 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.
I should not have this kind of behaviour, even using recursion, since
I'm only using lazy constructs all 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
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
&g
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_set
our intentions and let the system manage the
execution 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 Ãcri
nstructed __before__ any other piece of code have a
chance to execute. The type 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
are lazy ? Where can I find 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).
Th
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 th
cal memory 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
78 matches
Mail list logo