Yeah, that should work. The implementation is something like a byte
offset to the start of a line plus a character count, plus some misc
flags. I found this implementation in the 2.6 code (the last version
where it was pure Python code):
def _pack_cookie(self, position, dec_flags=0,
Ben Leslie wrote:
But the idea of transmitting these offsets outside of a running
process is not something that I had anticipated. It got me thinking:
is there a guarantee that these opaque values returned from tell() is
stable across different versions of Python?
Are they even guaranteed to
On Mon, Sep 26, 2016, at 05:30, Ben Leslie wrote:
> I think the case of JSON or SQL database is even more important though.
>
> tell/seek can return 129-bit integers (maybe even more? my maths might
> be off here).
>
> The very large integers that can be returned by tell() will break
>
It was pointed out in private email that technically JSON can
represent very large integers even if ECMAScript itself can't.
But the idea of transmitting these offsets outside of a running
process is not something that I had anticipated. It got me thinking:
is there a guarantee that these opaque
I think the case of JSON or SQL database is even more important though.
tell/seek can return 129-bit integers (maybe even more? my maths might
be off here).
The very large integers that can be returned by tell() will break
serialization to JSON, and storing in a SQL database (at least for
most
On 25 September 2016 at 17:21, MRAB wrote:
> On 2016-09-26 00:21, Ben Leslie wrote:
>>
>> Hi all,
>>
>> I recently shot myself in the foot by assuming that TextIO.tell
>> returned integers rather than opaque cookies. Specifically I was
>> adding an offset to the value
On 25 September 2016 at 21:18, Guido van Rossum wrote:
> Be careful though, comparing these to plain integers should probably
> be allowed,
There's a good reason why it's "opaque" ... why would you want to make it
less opaque?
And I'm curious why Python didn't adopt the
Be careful though, comparing these to plain integers should probably
be allowed, and we also should make sure that things like
serialization via JSON or storing in an SQL database don't break. I
personally think it's one of those "learn not to touch the stove"
cases and there's limited value in
On 26 September 2016 at 10:21, MRAB wrote:
> On 2016-09-26 00:21, Ben Leslie wrote:
>> Are there any downsides to this? I've made some progress developing a
>> patch to change this functionality. Is it worth polishing and
>> submitting?
>>
> An alternative might be a
On 2016-09-26 00:21, Ben Leslie wrote:
Hi all,
I recently shot myself in the foot by assuming that TextIO.tell
returned integers rather than opaque cookies. Specifically I was
adding an offset to the value returned by TextIO.tell. In retrospect
this doesn't make sense/
Now, I don't want to
Hi all,
I recently shot myself in the foot by assuming that TextIO.tell
returned integers rather than opaque cookies. Specifically I was
adding an offset to the value returned by TextIO.tell. In retrospect
this doesn't make sense/
Now, I don't want to drive change simply because I failed to read
11 matches
Mail list logo