New submission from Laurens <3.14159265...@xs4all.nl>:
file.tell() has become extremely slow in version 3.2, both rc1 and rc2. This
problem did not exist in version 2.7.1, nor in version 3.1. It could be
reproduced both on mac and windows xp.
--
components: IO
messages: 12787
Laurens <3.14159265...@xs4all.nl> added the comment:
Correction: the problem also exists in version 3.1. I created a benchmark
program an ran it on my machine (iMac, snow leopard 10.6), with the following
results:
--
2.6.6 (r266:84292, Dec 30 20
Laurens <3.14159265...@xs4all.nl> added the comment:
First of all, thanks to all for your cooperation, it is very much appreciated.
I made some minor changes to the benchmark program. Conclusions are:
* setting file._CHUNK_SIZE to 20 has a dramatic effect, changing execution
time in
Laurens <3.14159265...@xs4all.nl> added the comment:
All,
thanks for your help. Opening the file in binary mode worked immediately in the
toy program (that is, the benchmark code I sent you). (Antoine, thanks for the
hint.) In my real world program, I solved the problem by reading a lin
New submission from Jérôme Laurens :
There are some inconsistencies in the actual documentation of path lib's mkdir
doc.
Here is the 3.7 version, annotated and followed by a change proposal
Path.mkdir(mode=0o777, parents=False, exist_ok=False)
Create a new directory at this given pat
New submission from Jérôme Laurens :
Test code:
```
import re
test='''012345678
012345678
'''
pattern = r'^\s+?$'
m = re.search(pattern, test, re.M)
if m:
print(f'TEST FOUND "{m.span()}"')
def replace(m):
New submission from Jérôme LAURENS :
https://docs.python.org/3/reference/lexical_analysis.html#indentation reads
Point 1:
"Tabs are replaced (from left to right) by one to eight spaces such that the
total number of characters up to and including the replacement is a multiple of
eight&quo
Jérôme LAURENS added the comment:
To be more precise, consider code
def f(x):
\tx=0 # 7 spaces + one tab
return x # 8 spaces
In cpython, both indentation levels are 8 and no indentation error is reported
(this is the case where both tab size and alt tab size are equal)
If
New submission from Jérôme Laurens:
text is not catcher in case 3 below
INPUT
import xml.etree.ElementTree as ET
root1 = ET.fromstring('TEXT')
print(root1.text)
root2 = ET.fromstring('TEXT')
print(root2.text)
root3 = ET.fromstring('TEXT')
print(root3.text)
New submission from Jérôme Laurens:
The documentation for xml.etree.ElementTree.Element.text reads "If the element
is created from an XML file the attribute will contain any text found between
the element tags."
import xml.etree.ElementTree as ET
root3 = ET.fromstring('TEXT
Jérôme Laurens added the comment:
Since the text and tail notions seem tightly coupled, I would vote for a more
detailed explanation in the text doc and a forward link in the tail
documentation.
"""
text
The text attribute holds the text between the element's begin t
Jérôme Laurens added the comment:
The totsstring(..., method='text') is not suitable for the inner text because
it adds the tail of the top element.
A proper implementation would be
def innertext(elt):
return (elt.text or '') +''.join(innertext(e)+e.t
Jérôme Laurens added the comment:
Erratum
def innertext(elt):
return (elt.text or '') +''.join(innertext(e)+(e.tail or '') for e in elt)
--
___
Python tracker
<
13 matches
Mail list logo