Vertex color gradient is not linear
The gradient is linear but not in the colourspace you are expecting - as evidenced by the following :

Here the Attribute node is making the Vertex Color (Col) available to the shader. This is split into separate RGB components and compared with the Generated 'X' coordinate (which runs from 0.0 at the left to 1.0 at the right of the cube).
The gradient is linear but the end points are not as you expect (ie, the blue vertical grid-line is at X=0.5 and the gradient line runs from about 0.05 at the bottom through to around 0.525 at the top). This is due to sRGB colourspace conversion.
Your values of 0.25 and 0.75 relate to those 'absolute' values of approx 0.05 and 0.525 when converted from sRGB into the 'true' brightness - the sRGB colourspace is intended to make the most of an 0-bit integer representation of the brightness to make it as visually diverse as possible - so values at the start/end of the range and compressed/expanded to suit what would be noticable when displayed on a screen to the human eye.
See https://en.wikipedia.org/wiki/SRGB and note the red line on the following graph :

Using the axis values at the bottom and right of the graph you can see that 0.75 on the x-axis converts to around 0.5 in 'intensity' - your Python code is applying the sRGB value of 0.75 and producing an 'intensity' of approximately 0.525 for the upper limit. Similarly, the lower 0.25 is being converted at the bottom end of the graph to a much smaller 'intensity' value. That 'intensity' is what is being linearly interpolated to produce your resultant vertex colour gradient - not your original sRGB values.