New submission from Jim Garrison:
As of Python 3.2, `os.makedirs()` takes `exist_ok` as a keyword argument. If
set to true, the function does not raise an error if the directory already
exists. This makes the function's behavior similar to `mkdir -p` on the UNIX
commandline. (See https
Jim Garrison jgarri...@troux.com added the comment:
To clarify:
... it should never alter the content of (i.e. insert whitespace into)
existing text elements that contain non-whitespace characters.
--
___
Python tracker rep...@bugs.python.org
http
Jim Garrison jgarri...@troux.com added the comment:
Also needed here. While pretty-printing should be able to insert
non-significant whitespace BETWEEN xml elements, it should never alter
the content of (i.e. insert whitespace into) existing text elements.
--
nosy: +jgarrison
And as an interesting exercise, try
print r'test \'
print r'test \\'
Because of the way raw string parsing is defined, neither of these will
pass the parser. In fact, a raw string cannot have a backslash as
its last character.
--
http://mail.python.org/mailman/listinfo/python-list
Jim Garrison wrote:
Ye Liu wrote:
On Apr 6, 6:33 pm, Jim Garrison j...@acm.org wrote:
I notice the online docs (at docs.python.org/3.0/index.html) were
updated today. It seems some of the top-level pages, like
Tutorial, Using Python, Language Reference are truncated
after the first few
Ye Liu wrote:
On Apr 6, 6:33 pm, Jim Garrison j...@acm.org wrote:
I notice the online docs (at docs.python.org/3.0/index.html) were
updated today. It seems some of the top-level pages, like
Tutorial, Using Python, Language Reference are truncated
after the first few paragraphs.
Yea, same
I notice the online docs (at docs.python.org/3.0/index.html) were
updated today. It seems some of the top-level pages, like
Tutorial, Using Python, Language Reference are truncated
after the first few paragraphs.
--
http://mail.python.org/mailman/listinfo/python-list
New submission from Jim Garrison jgarri...@troux.com:
Trying to build 3.1a1 on Fedora 9, the following extensions get skipped
even though the requisite packages are installed
_dbm
_gdbm
_hashlib
_sqlite3
_ssl
bz2
IDLE (3.1a1) accepts
a,*b = re.split(str,pattern)
and does the right thing ('a' gets the first result and 'b' gets
the rest).
pydev configured to use the exact same Python 3.1a1 runtime doesn't
like this syntax (in my source, column 23 is the asterisk):
Encountered * at line 32,
Jim Garrison wrote:
IDLE (3.1a1) accepts
a,*b = re.split(str,pattern)
and does the right thing ('a' gets the first result and 'b' gets
the rest).
pydev configured to use the exact same Python 3.1a1 runtime doesn't
like this syntax (in my source, column 23 is the asterisk):
Encountered
Benjamin Peterson wrote:
Terry Reedy tjreedy at udel.edu writes:
3.1a1 is out and I believe it has the io improvements.
Massive ones, too. It'd be interesting to see your results on the alpha.
On 3.1a1 the unpickle step takes 2.4 seconds, an 1875% improvement.
Thanks.
--
Steve Holden wrote:
Jean-Paul Calderone wrote:
On Mon, 23 Mar 2009 10:57:54 -0500, Jim Garrison j...@acm.org wrote:
Benjamin Peterson wrote:
Terry Reedy tjreedy at udel.edu writes:
3.1a1 is out and I believe it has the io improvements.
Massive ones, too. It'd be interesting to see your
I'm converting a Perl system to Python, and have run into a severe
performance problem with pickle.
One facet of the system involves scanning and loading into memory a
couple of parallel directory trees containing OTO 10^4 files. The
trees don't change during development/testing and the scan
John Machin wrote:
On Mar 21, 9:25 am, Jim Garrison j...@acm.org wrote:
I'm converting a Perl system to Python, and have run into a severe
performance problem with pickle.
One facet of the system involves scanning and loading into memory a
couple of parallel directory trees containing OTO 10
Jim Garrison wrote:
John Machin wrote:
[snip]
Have you considered using cPickle instead of pickle?
Have you considered using *ickle.dump(..., protocol=-1) ?
I'm using Python 3 on Windows (Server 2003). According to the docs
The pickle module has an transparent optimizer (_pickle
Use case: parsing a simple config file line where lines start with a
keyword and have optional arguments. I want to extract the keyword and
then pass the rest of the line to a function to process it. An obvious
use of split(None,1)
cmd,args= = line.split(None,1);
if cmd in self.switch:
Luis Zarrabeitia wrote:
On Tuesday 17 March 2009 06:04:36 pm Jim Garrison wrote:
with open(filename, rb) as f:
for buf in iter(lambda: f.read(1000),''):
do_something(buff)
This is the most pythonic solution yet.
Thanks to all the responders who took time to ponder this seemingly
Jim Garrison wrote:
Luis Zarrabeitia wrote:
On Tuesday 17 March 2009 06:04:36 pm Jim Garrison wrote:
with open(filename, rb) as f:
for buf in iter(lambda: f.read(1000),''):
do_something(buf)
This is the most pythonic solution yet.
Thanks to all the responders who took time
Andrii V. Mishkovskyi wrote:
Just before you start writing a PEP, take a look at `takewhile'
function in `itertools' module. ;)
OK, after reading the itertools docs I'm not sure how to use it
in this context. takewhile() requires a sequence, and turning
f.read(bufsize) into an iterable
S Arrowsmith wrote:
Jim Garrison j...@acm.org wrote:
It's a shame the iter(o,sentinel) builtin does the
comparison itself, instead of being defined as iter(callable,callable)
where the second argument implements the termination test and returns a
boolean. This would seem to add much more
I'm an experienced C/Java/Perl developer learning Python.
What's the canonical Python way of implementing this pseudocode?
String buf
File f
while ((buf=f.read(1)).length() 0)
{
do something
}
In other words, I want to read a potentially large file in
Tim Chase wrote:
Am I missing something basic, or is this the canonical way:
with open(filename,rb) as f:
buf = f.read(1)
while len(buf) 0
# do something
buf = f.read(1)
That will certainly do. Since read() should simply
andrew cooke wrote:
Jim Garrison wrote:
I'm an experienced C/Java/Perl developer learning Python.
What's the canonical Python way of implementing this pseudocode?
[snip]
embarrassed by the other reply i have read,
There's always some trollish behavior in any comp.lang.*
group. Too many
I'm an experienced Perl developer learning Python, but I seem to
be missing something about raw strings. Here's a transcript of
a Python shell session:
Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type copyright, credits or license() for more
Tim Chase wrote:
ra\
SyntaxError: EOL while scanning string literal (pyshell#45, line 1)
It seems the parser is interpreting the backslash as an escape
character in a raw string if the backslash is the last character.
Is this expected?
Yep...as documented[1], even a raw string cannot end
Tim Chase wrote:
ra\
SyntaxError: EOL while scanning string literal (pyshell#45, line 1)
It seems the parser is interpreting the backslash as an escape
character in a raw string if the backslash is the last character.
Is this expected?
Yep...as documented[1], even a raw string cannot end
26 matches
Mail list logo