Message11906
While the fileseek tested "passed" in Python 2.7.12, here is the output:
==========
readline() position-> 101
Seek back amt-------> -100
New position--------> 1
Correct position
--- Result of seekboth() ---
read() position------> 1024
readline() position--> 4202
Seek back amt--------> -100
New position---------> 4102
Correct position
========
If you look closely, the readline() test is correct. Readline() reads to the newline character. In the seekboth, however, readline() does NOT read to the newline, reading the whole file. Therefore, while it seems to pass, it actually fails because the "behavior" of readline() is to 'read the line from the file and retain the newline'. Correct?
Now, there's a question of whether this is important, and maybe there's no application in the real world for its use, except looking for "marker" as you mentioned.
I'm expanding my fileseek.py to include seeking forward, but I will NOT upload it... It's at the ad nauseum stage at htis point. |
|
Date |
User |
Action |
Args |
2018-04-14 16:12:26 | psykiatris | set | messageid: <1523722346.92.0.682650639539.issue2363@psf.upfronthosting.co.za> |
2018-04-14 16:12:26 | psykiatris | set | recipients:
+ psykiatris, fwierzbicki, zyasoft, jeff.allen, santa4nt, amit |
2018-04-14 16:12:26 | psykiatris | link | issue2363 messages |
2018-04-14 16:12:26 | psykiatris | create | |
|