Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41814

Re: io.BytesIO

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'attribute': 0.05; 'sys': 0.05; 'bytes.': 0.07; 'itself,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'after,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'resize': 0.16; 'structure.': 0.16; 'wrote:': 0.17; 'memory': 0.18; 'import': 0.21; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'question': 0.27; 'header:X-Complaints-To:1': 0.28; "d'aprano": 0.29; 'obj': 0.29; 'steven': 0.29; 'gets': 0.32; 'allocated': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'pm,': 0.35; 'there': 0.35; 'received:org': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'back': 0.62; '10000': 0.65; '2013': 0.84; 'object:': 0.84; 'received:186': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Fabian von Romberg <fromberg100@hotmail.com>
Subject Re: io.BytesIO
Date Mon, 25 Mar 2013 00:10:04 -0500
References <mailman.3688.1364183789.2939.python-list@python.org> <514fd6d3$0$29998$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 186.68.114.214
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0
In-Reply-To <514fd6d3$0$29998$c3e8da3$5496439d@news.astraweb.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3689.1364188221.2939.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364188221 news.xs4all.nl 6859 [2001:888:2000:d::a6]:44785
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41814

Show key headers only | View raw


Hi Steven,


actually why I need is to know how much memory has been allocated for buffering.

getsizeof gets the size of the object structure.

For example, if I do io.BytesIO.truncate(10000), it will resize the buffer to 10000 bytes.  So my question is how to get those 10000 back from an 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 as for any object:
> 
> py> import io, sys
> py> obj = io.BytesIO()
> py> sys.getsizeof(obj)
> 48
> 
> 
> Is this what you are after, the size of the object itself, including any 
> overhead?
> 
> 

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

io.BytesIO Fabian von Romberg <fromberg100@hotmail.com> - 2013-03-24 22:56 -0500
  Re: io.BytesIO Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-25 04:47 +0000
    Re: io.BytesIO Fabian von Romberg <fromberg100@hotmail.com> - 2013-03-25 00:10 -0500
      Re: io.BytesIO Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-25 06:54 +0000
        Re: io.BytesIO Fabian von Romberg <fromberg100@hotmail.com> - 2013-03-25 21:43 -0500

csiph-web