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 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
Ye Liu wrote:
On Apr 6, 6:33 pm, Jim Garrison 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.
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
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 th
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, colu
Steve Holden wrote:
Jean-Paul Calderone wrote:
On Mon, 23 Mar 2009 10:57:54 -0500, Jim Garrison wrote:
Benjamin Peterson wrote:
Terry Reedy 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 al
Benjamin Peterson wrote:
Terry Reedy 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.
--
http://mail.python.org/mailm
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 pickl
John Machin wrote:
> On Mar 21, 9:25 am, Jim Garrison 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 para
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 tak
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: s
S Arrowsmith wrote:
Jim Garrison 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 generality.
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 require
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 respond
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 p
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 &q
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()
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 100
Tim Chase wrote:
>>> r"a\"
SyntaxError: EOL while scanning string literal (, 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 in a
Tim Chase wrote:
>>> r"a\"
SyntaxError: EOL while scanning string literal (, 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 in a
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 infor
22 matches
Mail list logo