getting the size of an object

filox filox_realmmakniovo at yahoo.com
Mon Jun 18 15:48:36 EDT 2007


"Brett Hoerner" <bretthoerner at bretthoerner.com> wrote in message 
news:1182182932.947333.251020 at o61g2000hsh.googlegroups.com...
> On Jun 18, 11:07 am, "filox" <filox_realmmakni... at yahoo.com> wrote:
>> is there a way to find out the size of an object in Python? e.g., how 
>> could
>> i get the size of a list or a tuple?
>
> "Size" can mean a lot of things,
>
> len(my_list)
> len(my_tuple)
>
> Although I have the feeling you mean "how many bytes does this object
> take in memory" - and I believe the short answer is no.
>

is there a long answer? what i want is to find out the number of bytes the 
object takes up in memory (during runtime). since python has a lot of 
introspection mechanisms i thought that should be no problem...


-- 
You're never too young to have a Vietnam flashback 





More information about the Python-list mailing list