On Mon, Feb 21, 2005, Karl Chen wrote:
>
> A slightly tweaked wordsep_re:
> textwrap.TextWrapper.wordsep_re = \
> re.compile(r'(\s+|' # any whitespace
>r'[^\s\w]*\w+[a-zA-Z]-(?=[a-zA-Z]\w+)|' # hyphenated words
>r'(?<=[\w\!\"\'\&\
> Really? I do this kind of thing all the time:
>
> import os
> import errno
> try:
> os.makedirs(dn)
> except OSError, e:
> if e.errno <> errno.EEXIST:
> raise
You have a lot more faith in the errno module than I do. Are you sure
the same error codes work on all platforms where
On Tue, 22 Feb 2005 08:16:52 -0800, Guido van Rossum
<[EMAIL PROTECTED]> wrote:
> > Really? I do this kind of thing all the time:
> >
> > import os
> > import errno
> > try:
> > os.makedirs(dn)
> > except OSError, e:
> > if e.errno <> errno.EEXIST:
> > raise
>
> You have a lot mor
Fredrik Lundh wrote:
it could be worth expanding them to
"if x == 1 or x == 2 or x == 3:"
though...
C:\>timeit -s "a = 1" "if a in (1, 2, 3): pass"
1000 loops, best of 3: 0.11 usec per loop
C:\>timeit -s "a = 1" "if a == 1 or a == 2 or a == 3: pass"
1000 loops, best of 3: 0.0691 usec pe
Hi,
textwrap.fill() is awesome.
Except when the string to wrap contains dates -- which I would
like not to be filled. In general I think wordsep_re can be
smarter about what it decides are hyphenated words.
For example, this code:
print textwrap.fill('aa 2005-02-21', 18)
produces:
On Tuesday 22 February 2005 03:01 am, Guido wrote:
>
> BTW, there's *still* no sign from a PEP 246 rewrite. Maybe someone
> could offer Clark a hand? (Last time I inquired he was recovering from
> a week of illness.)
Last summer Alex, Clark, Phillip and I swapped a few emails about reviving the
>> if e.errno <> errno.EEXIST:
>> raise
>
>You have a lot more faith in the errno module than I do. Are you sure
>the same error codes work on all platforms where Python works? It's
>also not exactly readable (except for old Unix hacks).
On the other hand, LBYL in this context can resu
[EMAIL PROTECTED]
> Modified Files:
>compile.c
> Log Message:
> Teach the peepholer to fold unary operations on constants.
>
> Afterwards, -0.5 loads in a single step and no longer requires a runtime
> UNARY_NEGATIVE operation.
Aargh. The compiler already folded in a leading minus for int
Patch / Bug Summary
___
Patches : 308 open (+10) / 2755 closed ( +1) / 3063 total (+11)
Bugs: 838 open (+15) / 4834 closed ( +5) / 5672 total (+20)
RFE : 168 open ( +0) / 148 closed ( +4) / 316 total ( +4)
New / Reopened Patches
__
do not ad