Showing content from http://mail.python.org/pipermail/python-dev/attachments/20090928/026d23a8/attachment-0001.htm below:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Antoine Pitrou a écrit :
<blockquote cite="mid:h9nihf$9f4$1@ger.gmane.org" type="cite">
<pre wrap="">
Hello,
</pre>
<blockquote type="cite">
<pre wrap="">So here is the proposed semantic, which matches established conventions:
*IOBase.truncate(n: int = None) -> int*
</pre>
</blockquote>
<pre wrap=""><!---->[...]
I still don't think there is a sufficient benefit in breaking
compatibility. If you want the file pointer to remain the same, you can
save it first and restore it afterwards manually.
</pre>
</blockquote>
Sure, but won't this truncate become some kind of a burden for py3k, if
it's twice misleading (it's not a real truncation since it can extend
the file, and it's not even a truncation or resizing in posix/win32
style, since the filepointer is moved) ?<br>
Since it was an undocumented behaviour, and py3k doesn't seem to be
present yet in production environments (or is it ?), I'd promote this
late-but-maybe-not-too-late change. <br>
But if the consensus prefers the current behaviour, well, it'll be OK
to me too, as long as it's sufficiently documented and advertised.<br>
<br>
<blockquote cite="mid:h9nihf$9f4$1@ger.gmane.org" type="cite">
<pre wrap=""></pre>
<blockquote type="cite">
<pre wrap="">*Propositions of doc update*
</pre>
</blockquote>
<pre wrap=""><!---->
Please open tracker issues for these kinds of suggestions.
</pre>
</blockquote>
Is the tracker Ok for simple suggestions too ? I thought it was rather
for obvious bugfixes, and to-be-discused propositions had better be in
mailing-lists... OK then, I'll open bugtracker issues for these. B-)<br>
<br>
<br>
<br>
<blockquote cite="mid:4ABF7BF6.5070903@mrabarnett.plus.com" type="cite">Instead
of "than size", perhaps "than n". <br>
<br>
</blockquote>
Whoups, indeed >_<<br>
Actually the signature would rather be:<br>
*IOBase.truncate(size: int = None) -> int*
<br>
And I forgot to mention that truncate returns the new file size
(according to the current PEP)...<br>
<br>
<br>
<blockquote cite="mid:4ABF7BF6.5070903@mrabarnett.plus.com" type="cite">Should
an exception be raised if start and/or end are out of range? <br>
</blockquote>
I'd advocate it yep, for the sake of "explicit errors". However, should
it be a ValueError (the ones io functions normally use) or an
IndexError (which is technically more accurate, but might confuse the
user) ?<br>
<br>
<br>
Regards, <br>
Pascal<br>
<br>
<br>
<br>
<br>
</body>
</html>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4