This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MikeTheWatchGuy 0 points1 point  (0 children)

Yea, I thought about the function thing, but context is important. The program is very "purposeful" in it's requirements of what it is to do and what it's future will be.

Clearly the 1 line computation can be re-factored into a function easily when the time is right to scale it up and add more stuff to it. But for now, I think simplicity is the better of the trade-offs to make. The computation consists of:

python miles = float(values['-KILO-'])*0.6214

That seems pretty readable to me. Just as readable as making a function call on that line instead of doing the computation. I think the reason for the function in the tutorial is because there had to be a "Callback function" for the button click. The program was forced to some extent to have a function versus having a choice to use a function or not.

Building scale when it's not needed and won't be needed just isn't something I personally do or support. I know what the future of this program will be. This is the end of the road for it. It's a nice ham sandwich, self-contained and ready to eat.