homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abarnert
Recipients Douglas.Alan, abarnert, amaury.forgeotdarc, benjamin.peterson, eric.araujo, facundobatista, georg.brandl, jcon, ncoghlan, nessus42, pitrou, r.david.murray, ralph.corderoy, rhettinger, ysj.ray
Date 2014年07月20日.00:45:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405817125.01.0.559945778129.issue1152248@psf.upfronthosting.co.za>
In-reply-to
Content
One last thing, a quick & dirty solution that works today, if you don't mind accessing private internals of stdlib classes, and don't mind giving up the performance of _io for _pyio, and don't need a solution for binary files:
class MyTextIOWrapper(_pyio.TextIOWrapper):
 def readrecord(self, sep):
 readnl, self._readnl = self._readnl, sep
 try:
 return self.readline()
 finally:
 self._readnl = readnl
Or, if you prefer:
class MyTextIOWrapper(_pyio.TextIOWrapper):
 def __init__(self, *args, separator, **kwargs):
 super().__init__(*args, **kwargs)
 self._readnl = separator
For binary files, there's no solution quite as simple; you need to write your own readline method by copying and pasting the one from _pyio.RawIOBase, and the modifications to use an arbitrary separator aren't quite as trivial as they look at first (at least if you want multi-byte separators).
History
Date User Action Args
2014年07月20日 00:45:25abarnertsetrecipients: + abarnert, georg.brandl, rhettinger, facundobatista, amaury.forgeotdarc, ncoghlan, pitrou, benjamin.peterson, nessus42, eric.araujo, ralph.corderoy, r.david.murray, ysj.ray, Douglas.Alan, jcon
2014年07月20日 00:45:25abarnertsetmessageid: <1405817125.01.0.559945778129.issue1152248@psf.upfronthosting.co.za>
2014年07月20日 00:45:25abarnertlinkissue1152248 messages
2014年07月20日 00:45:24abarnertcreate

AltStyle によって変換されたページ (->オリジナル) /