Message99496
The following snippet behaves differently in the C IO implementation than in the Python IO implementation:
import sys
sys.stdout.write('unicode ')
sys.stdout.buffer.write(b'bytes ')
To test this, I have created two scripts, testpyio.py (using _pyio) and testio.py (using _io). The output is as follows:
% python3 testpyio.py
unicode bytes
% python3 testio.py
bytes unicode
%
In my opinion, the behavior exhibited by _pyio is more correct. It appears that to get the C implementation to print the lines in the correct order, there must be a flush in between the statements. This extra flush would create a lot of overhead.
I am attaching the two test scripts.
The C implementation prints the output in the correct order if each write ends with a newline. |
|
Date |
User |
Action |
Args |
2010-02-18 06:41:17 | amcnabb | set | recipients:
+ amcnabb |
2010-02-18 06:41:17 | amcnabb | set | messageid: <1266475277.48.0.657351294204.issue7955@psf.upfronthosting.co.za> |
2010-02-18 06:41:15 | amcnabb | link | issue7955 messages |
2010-02-18 06:41:14 | amcnabb | create | |
|