I have a string which I converted to binary representation using str.encode('utf-8').
After that I expect getsizeof() and len() return the same value, but it appears that sys.getsizeof() always return a bigger value.
I then send this binary data over socket to node.js server and store them in Buffer. Both Buffer.length and Buffer.byteLength return the same value, which is equal to len() value in Python.
I can't figure out what is going on there and why Buffer.byteLength is not the same as sys.getsizeof().
My data is not always strings or may have different encoding, so I want to make sure that I know the size in bytes, not in characters.