Torsten Rottmann added the comment:
Proposed patch to fix this:
set the default of n to 1 as stated by docs:
def _peek_unlocked(self, n=1):
return n bytes:
return self._read_buf[self._read_pos:self._read_pos+n]
--
___
Python tracker
<h
Torsten Rottmann added the comment:
Note: this is also in Python 2.6
--
___
Python tracker
<http://bugs.python.org/issue5811>
___
___
Python-bugs-list mailin
New submission from Torsten Rottmann :
The documented behavior of io.BufferedReader.peek([n]) states:
peek([n])
Return 1 (or n if specified) bytes from a buffer without advancing the
position.
Thereas the parameter n is the _max_ length of returned bytes.
Implementation is:
def
Torsten Rottmann <[EMAIL PROTECTED]> added the comment:
OK. I've read the Python Reference Manual 7.6 "Function Definition".
It "explains" why this happens.
BUT: Why can`t the compiler make a copy of the default object, if
it's mutable (e.g. a
New submission from Torsten Rottmann <[EMAIL PROTECTED]>:
The attached file produced the following result:
__
trott$ python2.5 p6.py
[]
[1234]
__
I expected both times the empty list since the print
statement prints just a defaulted parameter (&quo