3 ms·
Given that most string implementations have both a `len` and `cap` field (or eve just `len`), means that for every string data type, there is one more integer v
by nemothekid 11mo ago
Given that most string implementations have both a `len` and `cap` field (or eve just `len`), means that for every string data type, there is one more integer variables being used.
So integer definitely gets used more than strings, and I'd argue way more than floats in most programs.
- zahlman 11mo agoIn CPython, a string's length is stored internally as a machine integer (`Py_ssize_t`); when the `len` builtin is called, the corresponding integer object is created (or more likely, retrieved from cache) on the fly.