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

Consistency in code examples, newline or no newline? #128716

Open
StanFromIreland opened this issue Jan 10, 2025 · 3 comments
Open

Consistency in code examples, newline or no newline? #128716

StanFromIreland opened this issue Jan 10, 2025 · 3 comments
Labels
docs Documentation in the Doc dir pending The issue will be closed if no feedback is provided

Comments

@StanFromIreland
Copy link
Contributor

Currently there is a mixture of including the empty line and not including it for example in the decimal docs:

>>> def mul(x, y, fp=TWOPLACES):
    ...     return (x * y).quantize(fp)
    ...

>>> def div(x, y, fp=TWOPLACES):
    ...     return (x / y).quantize(fp)

>>> def remove_exponent(d):
    ...     return d.quantize(Decimal(1)) if d == d.to_integral() else d.normalize()

I propose we standardize this to either including it or not including it. (I'm a very big fan of consistency)

@StanFromIreland StanFromIreland added the docs Documentation in the Doc dir label Jan 10, 2025
@AA-Turner
Copy link
Member

I'm not sure I understand? The page you reference seems consistent, in that the examples reflect a console session.

Do you mean the lack of a trailing ... line in the div and remove_exponent cases?

A

@StanFromIreland
Copy link
Contributor Author

@AA-Turner

Yes, I propose to either always have it or never have it.

@AA-Turner
Copy link
Member

AA-Turner commented Jan 10, 2025

I don't think we should add a final ... line solely for consistency's sake. Adding unnecessary continuation lines creates visual noise and make-work, and removing them makes examples less readable.

Others may disagree with me, but absent anything else I propose rejecting this proposal.

A

@AA-Turner AA-Turner added the pending The issue will be closed if no feedback is provided label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir pending The issue will be closed if no feedback is provided
Projects
Status: Todo
Development

No branches or pull requests

2 participants