arogozhnikov / python3_with_pleasure

A short guide on features of Python 3 with examples
3.63k stars 199 forks source link

Less surprising code #23

Closed lebigot closed 6 years ago

lebigot commented 6 years ago

The Astropy convention makes the original code look strange: in the return statement, a speed in m/s divided by a wavelength in meters should give a result in Hertz, not THz. Now, the original code works fine (because only the units of the result are fully taken seriously), but the proposed change makes the code look more correct and thus raises fewer questions.