Are YOUR Variables In Python MEMORY EFFICIENT? 🧠

preview_player
Показать описание
This function in #Python can show you how much memory an object occupies in bytes. #Shorts
Рекомендации по теме
Комментарии
Автор

As far as I know, the range function is not storing all numbers because it is a generator.

enesguler
Автор

Yeah, range is an iterator, the list is all the content it yields ! Good video!

MrGribouillage
Автор

Note, getsizeof doesn't measure the size of the list recursively.. so the measurement literally only measures the size of *only* the list, and doesn't include the 100 integers.

The number you're seeing should be 100 8-byte pointers, each pointing to an integer plus some extra 56 bytes for the list object metadata probably.

SaniSensei
Автор

One more nice short lesson in the books 🤓.
Thanks a lot 😉👍!

dcknature
Автор

Wait, does this work as
print(n_list.__sizeof__())

CasualPythonCoder
Автор

Is getsizeof the same as the attribute __sizeof__?

Ze-hygw
Автор

There is a question...
How to know which function is in a file or folder..??

yashbanait...
Автор

Nice, CTRL + Shift + D to duplicate. Ty

Bluedragon
Автор

just use assembly bro, super efficient

nonEuclideanExplosive
Автор

is it me or getsizeof is not use like this? or is not use as a reference? like in the video example because yes the other will have bigger size but because you have a list?

asagiai
Автор

Why would anyone store a range object in a variable?

jorgehenriquesoares
Автор

how to check if an input with type of int is empty ?

peterkim