>> actually why I need is to know how much memory has been allocated for
>> buffering.
>>
>> getsizeof gets the size of the object structure.
>
> I can see at least four ways to get the current size of the BytesIO
> buffer:
>
> py> obj = io.BytesIO(
f the BytesIO
buffer:
py> obj = io.BytesIO(b"x"*12468)
py> obj.getbuffer().nbytes
12468
py> len(obj.getvalue())
12468
py> len(obj.getbuffer())
12468
py> obj.seek(0, 2)
12468
As far as I can tell, BytesIO objects do not have a fixed size buffer.
They will increase in si
attribute
or method?
Regards,
Fabian
On 03/24/2013 11:47 PM, Steven D'Aprano wrote:
> On Sun, 24 Mar 2013 22:56:12 -0500, Fabian von Romberg wrote:
>
>> Hi,
>>
>> is there any way to get the allocated memory size from a io.BytesIO
>> object?
>
> The same a
On Sun, 24 Mar 2013 22:56:12 -0500, Fabian von Romberg wrote:
> Hi,
>
> is there any way to get the allocated memory size from a io.BytesIO
> object?
The same as for any object:
py> import io, sys
py> obj = io.BytesIO()
py> sys.getsizeof(obj)
48
Is this what you are a
Hi,
is there any way to get the allocated memory size from a io.BytesIO object?
Thanks and regards,
Fabian
--
http://mail.python.org/mailman/listinfo/python-list