They shouldn't, really, and I don't care too much about what happens
in that case. It may depend on whether the I/O device honors seeks
beyond EOF or not.

On 7/20/07, Alexandre Vassalotti <[EMAIL PROTECTED]> wrote:
> How this different from setting the position to the new size? What
> should happen when someone call truncate() with an argument greater
> than the current size? Should it do a seek, or nothing?
>
> Thanks,
> -- Alexandre
>
> On 7/18/07, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> > Unless anyone cares, it should imply a seek to the indicated position
> > if an argument was present.
> >
> > On 7/18/07, Alexandre Vassalotti <[EMAIL PROTECTED]> wrote:
> > > So, any decision on the proposed semantic change of truncate?
> > >
> > > On 7/3/07, Alexandre Vassalotti <[EMAIL PROTECTED]> wrote:
> > > > On 7/2/07, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> > > > > Honestly, I think truncate() should always set the current position to
> > > > > the new size, even though that's not what it currently does.
> > > >
> > > > Thought about that and I think that would be the best thing to do.
> > > > That would avoid making StringIO unnecessary different from BytesIO.
> > > > And IMHO, it is less prone to bugs. If someone wants to truncate while
> > > > keeping the current position, then he will have to state is intention
> > > > explicitly by saving the value of tell() and calling seek() after
> > > > truncating.
> > > >
> > > > I also find the semantic make more sense too. For example:
> > > >
> > > >    >>> s = StringIO("Good bye, world")
> > > >    >>> s.truncate(10)
> > > >    >>> s.write("cruel world")
> > > >    >>> s.getvalue()
> > > >    ???
> > > >
> > > > I think that should return "Good bye, cruel world", not "cruel world".
> > > >
> > > > So, does anyone else agree with this small semantic change of 
> > > > truncate()?
> > > >
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to