double
Scalar- Go Type
float64- Python Type
float
float
Scalar- Go Type
float32- Python Type
float
int64
ScalarUses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.
- Go Type
int64- Python Type
int/long
uint64
ScalarUses variable-length encoding.
- Go Type
uint64- Python Type
int/long
int32
ScalarUses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.
- Go Type
int32- Python Type
int
fixed64
ScalarAlways eight bytes. More efficient than uint64 if values are often greater than 256.
- Go Type
uint64- Python Type
int/long
fixed32
ScalarAlways four bytes. More efficient than uint32 if values are often greater than 228.
- Go Type
uint32- Python Type
int/long
bool
Scalar- Go Type
bool- Python Type
bool
string
ScalarA string must always contain UTF-8 encoded or 7-bit ASCII text, and cannot be longer than 232.
- Go Type
string- Python Type
str/unicodePython strings are represented as unicode on decode but can be str if an ASCII string is given (this is subject to change).
bytes
ScalarMay contain any arbitrary sequence of bytes no longer than 232.
- Go Type
[]byte- Python Type
str (Python 2), bytes (Python 3)
uint32
ScalarUses variable-length encoding.
- Go Type
uint32- Python Type
int/long
sfixed32
ScalarAlways four bytes.
- Go Type
int32- Python Type
int
sfixed64
ScalarAlways eight bytes.
- Go Type
int64- Python Type
int/long
sint32
ScalarUses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.
- Go Type
int32- Python Type
int
sint64
ScalarUses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.
- Go Type
int64- Python Type
int/long