FAI-CIVL / FAI-Airscore

AirScore - online paragliding / hanggliding GAP-based scoring software.
https://airscore.cc/
GNU General Public License v3.0
13 stars 17 forks source link

redundant "0 +" in code #240

Closed kuaka closed 3 years ago

kuaka commented 3 years ago

particularly in formula.get_fsdb_info but I believe also elsewhere there are a lot of statements where 0 is added. I don't believe that this has any point/effect.

What is the reason?

in this particular function they are usually in the format 0 + float/int(get_from_dict()) replicating this in console:

`>>>x={'a':2,'b':'4'}'

'>>>0 + float(x.get('b')) * 1000 4000.0'

'>>> 0 + float(x.get('a')) * 1000 2000.0'

'>>> float(x.get('a')) * 1000 2000.0'

'>>> 0 + float(x.get('z')) * 1000 Traceback (most recent call last): File "", line 1, in TypeError: float() argument must be a string or a number, not 'NoneType' `

A float of None will cause an error regardless of the zero.

kuaka commented 3 years ago

I had a feeling I had asked this before. I see that I asked in telegram (march 21) and the answer was that there was no real reason. I will remove from the code to make it more readable.