[pypy-dev] long.__itemsize__
Hi, In my code I need something like long.__itemsize__ in Python. Any suggestions to do it with pypy? Regards, Arnd ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] long.__itemsize__
Hi, __itemsize__ - in bytes, corresponds to item size field in the types definition structure. It's a field for types. See: http://docs.python.org/c-api/typeobj.html#tp_itemsize On Tue, Dec 21, 2010 at 9:36 AM, Maciej Fijalkowski fij...@gmail.com wrote: On Tue, Dec 21, 2010 at 10:58 AM, Arnd Rechenburg arnd.rechenb...@tomtom.com wrote: Hi, In my code I need something like long.__itemsize__ in Python. Any suggestions to do it with pypy? Hey. This attribute is undocumented and untested as far as I can tell. What does it do? Cheers, fijal Regards, Arnd ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] long.__itemsize__
On Tue, Dec 21, 2010 at 1:02 PM, René Dudfield ren...@gmail.com wrote: Hi, __itemsize__ - in bytes, corresponds to item size field in the types definition structure. It's a field for types. See: http://docs.python.org/c-api/typeobj.html#tp_itemsize Well... Those are docs for C API. It doesn't say it's exposed at applevel nor since which version. (Also, to be precise, C API is known to be implementation specific) ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] long.__itemsize__
On 21/12/10 12:05, Maciej Fijalkowski wrote: __itemsize__ - in bytes, corresponds to item size field in the types definition structure. It's a field for types. See: http://docs.python.org/c-api/typeobj.html#tp_itemsize Well... Those are docs for C API. It doesn't say it's exposed at applevel nor since which version. (Also, to be precise, C API is known to be implementation specific) Moreover, I don't think we could give it a sane semantics on PyPy, given that the same applevel type can be potentially implemented by many different low level structures with different sizes. ciao, Anto ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] long.__itemsize__
On Tue, Dec 21, 2010 at 1:31 PM, Antonio Cuni anto.c...@gmail.com wrote: On 21/12/10 12:05, Maciej Fijalkowski wrote: __itemsize__ - in bytes, corresponds to item size field in the types definition structure. It's a field for types. See: http://docs.python.org/c-api/typeobj.html#tp_itemsize Well... Those are docs for C API. It doesn't say it's exposed at applevel nor since which version. (Also, to be precise, C API is known to be implementation specific) Moreover, I don't think we could give it a sane semantics on PyPy, given that the same applevel type can be potentially implemented by many different low level structures with different sizes. Not even potentially, it actually is in some places. ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] long.__itemsize__
Hi, On Tue, Dec 21, 2010 at 9:58 AM, Arnd Rechenburg arnd.rechenb...@tomtom.com wrote: In my code I need something like long.__itemsize__ in Python. I suppose the question is why? This is supposed to be the size in bytes occupied by one element of the type, and one element of long happens to be 15 bits, so that's why long.__itemsize__ is 2. It has no other meaning. If you are interested in an estimate of how many bytes some actual object takes, we have some functions in the 'gc' module, but even that is incomplete -- there are cases were it's hard to come up with a definitive answer, like objects based on mapdicts. A bientôt, Armin. ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] long.__itemsize__
sys.getsizeof(obj) ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] long.__itemsize__
Hi René, On Tue, Dec 21, 2010 at 1:24 PM, René Dudfield ren...@gmail.com wrote: sys.getsizeof(obj) Ah, thank you, didn't know about it. It's a 2.6 feature only though. A bientôt, Armin. ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev