charleshixsn at earthlink.net
Tue Sep 12 18:28:55 CEST 2000
Martin von Loewis wrote:
> You can't copy file objects. I'm not sure why you want to, either -
> just use the one you've got in all places.
> If you really want such a functionality, you can use the Unix dup(2)
> interface to create a second file handle. You can also use the
> posixfile module on top of that, i.e.
> pfile = posixfile.fileopen(newsocket)
> filecopy = pfile.dup()
> As for copying adding variables to a socket object: That won't work,
> either. A socket object does not support arbitary attributes, only the
> documented ones. Again, wrapping it with a posixfile may be a
> solution, but the wrong one - you shall not modify other objects attributes.
This may not be the same thing, but one reason for wanting to duplicate the handle
is so that one can be modifying the file in two different locations at the same
time. Of course, all one really needs to do is use pos and tell, and move back
and forth, but that can be a bit clumsy.
-- (c) Charles Hixson
-- Addition of advertisements or hyperlinks to products specifically prohibited
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 153 bytes
Desc: Card for Charles Hixson
More information about the Python-list