Code review comment for lp:~bialix/bzr/2.4-bug-967060

Revision history for this message
Alexander Belchenko (bialix) wrote :

John A Meinel пишет:
> I'm pretty sure writing "cdef public int st_dev" does create some sort of
> accessor function for the attribute, since it has to turn the int into a
> PyInt. So it is pretty much the same to write:
>
> property st_dev:
> def __get__: return 0

Well, actually access to int variable performed by internal Python
function, so Pyrex does not generate any special explicit accessor
function, but only creates an entry in tp_members structure. But for
property Pyrex does generate special (although trivial) code to convert
C zero to proper Python object.

> So i would slight prefer the property approach. I don't think either is
> going to be a measurable impact, though.

OK, I'll change the code to use properties. That way we can avoid
duplication in setting those variables to zero and save 16 bytes for
each stat object instance.

« Back to merge proposal