double

Scalar
Go Type
float64
Python Type
float

float

Scalar
Go Type
float32
Python Type
float

int64

Scalar

Uses 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

Scalar

Uses variable-length encoding.

Go Type
uint64
Python Type
int/long

int32

Scalar

Uses 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

Scalar

Always eight bytes. More efficient than uint64 if values are often greater than 256.

Go Type
uint64
Python Type
int/long

fixed32

Scalar

Always 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

Scalar

A string must always contain UTF-8 encoded or 7-bit ASCII text, and cannot be longer than 232.

Go Type
string
Python Type
str/unicode

Python strings are represented as unicode on decode but can be str if an ASCII string is given (this is subject to change).

bytes

Scalar

May contain any arbitrary sequence of bytes no longer than 232.

Go Type
[]byte
Python Type
str (Python 2), bytes (Python 3)

uint32

Scalar

Uses variable-length encoding.

Go Type
uint32
Python Type
int/long

sfixed32

Scalar

Always four bytes.

Go Type
int32
Python Type
int

sfixed64

Scalar

Always eight bytes.

Go Type
int64
Python Type
int/long

sint32

Scalar

Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.

Go Type
int32
Python Type
int

sint64

Scalar

Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.

Go Type
int64
Python Type
int/long