sopel-irc / sopel

:robot::speech_balloon: An easy-to-use and highly extensible IRC Bot framework. Formerly Willie.
https://sopel.chat
Other
949 stars 403 forks source link

calc: improvements/config #2547

Open ghost opened 11 months ago

ghost commented 11 months ago

Preface: this can likely wait for calc to be extracted (sopel-calc or whatever), but there's a couple of things I'd like to see either be changed or made as config options.


First: please, please, for the love of God let me turn off e+# notation. Sometimes it's not even useful and literally takes more characters...

\<user> .c 123456*123456 \<bot> [calc] 1.524138394e+10

What was saved here? Instead of outputting 15241383936 it rounded up the second-to-last digit and then added 3 extra characters...

Anyway, I understand if configuration would be preferred here. I'm sure some people prefer the e+# stuff. Neither me nor my users do, but I realize we're not the whole world.


Second: I've love to have commas in the output, especially if the above is implemented. e.g.:

\<user> .c 123456*123456 \<bot> [calc] 15,241,383,936

Can totally understand this being optional. In theory it'd be a simple if/else on the output.

if some_config == add_commas:
    '{:,}'.format(result)
else:
    str(result)

or whatever. :P