Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small mistake in the documentation ? #2956

Open
AdelKS opened this issue May 16, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@AdelKS
Copy link

commented May 16, 2019

Hello,

I have been reading Cython's documentation lately, and I fell on maybe a little mistake on "Working with Python arrays". In the API reference here's what we can read:

int resize_smart(array self, Py_ssize_t n) except -1
Efficient for small increments; uses growth pattern that delivers amortized linear-time appends.

So that basically it says it gives amortized linear-time appends, shouldn't it be amortized constant time appends ? Just like with C++ vectors ?

Thank you,

Adel

@scoder

This comment has been minimized.

Copy link
Contributor

commented May 19, 2019

Both try to express the same thing, just seen from a different angle. Each append runs in amortized constant time, yes. But the "amortized" suggests (or requires) a series of appends, which then all run in a time that is amortized linear with the number of appends.

I wouldn't mind changing it to constant, though. PR welcome.

@AdelKS

This comment has been minimized.

Copy link
Author

commented May 20, 2019

Okay I understand better now. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.