8000 PoC: rip out the allocator API by erlend-aasland · Pull Request #33 · Argument-Clinic/cpython · GitHub
[go: up one dir, main page]

Skip to content

PoC: rip out the allocator API #33

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

Conversation

erlend-aasland
Copy link

No description provided.

@erlend-aasland
Copy link
Author

Alternative to #31

Copy link
@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!! A few suggestions to simplify the code even more. I've checked locally that all tests pass with them applied

Comment on lines 6337 to 6338
lines = [p.render_docstring() + "\n" for p in params if p.docstring]
return "".join(lines)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lines = [p.render_docstring() + "\n" for p in params if p.docstring]
return "".join(lines)
return "".join(p.render_docstring() + "\n" for p in params if p.docstring)

We could even just get rid of this method and inline the call: it's only called in one place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutely.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH, the method name increases the readability slightly.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we can keep it as a separate method!

…APIs

Replace the internal accumulator APIs by using lists of strings and join().

Yak-shaving for separating out formatting code into a separate file.
Comment on lines +1803 to +1805
out.append(s.format(f.full_name, count_min, count_max))
out.append(' goto exit;\n')
out.append("}")
Copy link
@AlexWaygood AlexWaygood Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
out.append(s.format(f.full_name, count_min, count_max))
out.append(' goto exit;\n')
out.append("}")
out.extend([
s.format(f.full_name, count_min, count_max),
' goto exit;\n',
'}',
])

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I prefer the existing variant.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I don't feel strongly! The existing variant is fine

@erlend-aasland
Copy link
Author

Moved upstream!

@erlend-aasland
Copy link
Author

(I'll incorporate your latest suggestions over there)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0