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

Artihmetic expression as values #582

Closed
nyovaya opened this issue Dec 2, 2018 · 7 comments
Closed

Artihmetic expression as values #582

nyovaya opened this issue Dec 2, 2018 · 7 comments

Comments

@nyovaya
Copy link

nyovaya commented Dec 2, 2018

What about having arithmetic expression as a value, e.g.:

size = 1024 * 1024 * 8

which would simplify setting values which even derive from arithmetic expressions and as you just need to edit one multiplicand to change the wished result.

@pradyunsg
Copy link
Member

Is the underlying motivation the same as #427?

@nyovaya
Copy link
Author

nyovaya commented Dec 2, 2018

@pradyunsg no as it could also be used for time e.g.

time = 60 * 60 * 12

@eksortso
Copy link
Contributor

eksortso commented Dec 3, 2018

A time duration/timedelta type is proposed in #514.

Unit conversion suffixes and timedelta types would be pretty good additions to the standard, I think. Arbitrary arithmetic expressions, not so much.

@quadrupleslap
Copy link

Why is that better than a comment?

time = 43200 # 12 hours

@setop
Copy link

setop commented Feb 22, 2019

Why is that better than a comment?

time = 42300 # 12 hours

Because a comment can become inconsistent...

@nyovaya
Copy link
Author

nyovaya commented Feb 22, 2019

Why is that better than a comment?

time = 43200 # 12 hours

because you need to recalculate the whole instead of just changing one term

@pradyunsg
Copy link
Member

While I can see the value that this could have in certain situations, I don't think this is a super valuable addition. Broadly, I don't think a configuration file format should have operator logic happening within it. I think this is further demonstated by the lack of activity on this issue, compared to the rest of the issue tracker. :)

None the less, thanks for proposal and your patience on this!

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

No branches or pull requests

5 participants