HackerTrans
TopNewTrendsCommentsPastAskShowJobs

mdellavo

no profile record

comments

mdellavo
·5 lat temu·discuss
this is a common approach when you are dealing in rates less than .01 -- you just need to be sure you are rounding correctly
mdellavo
·5 lat temu·discuss
if you are typing out boilerplate you should look to abstract it away
mdellavo
·5 lat temu·discuss
It seems incorrect to determine a half a month as 16/31 but ok , for your proposed example:

    >>> from decimal import Decimal
    >>> Decimal(1000) * Decimal(16) / Decimal(31)
    Decimal('516.1290322580645161290322581')
    >>> 1000 * 16 / 31
    516.1290322580645
The point is using Decimal allows control over precision and rounding rather than accepting ad-hoc approximations of a float.

https://docs.python.org/3/library/decimal.html

If it were me, I wouldn't go around bragging about how much money my software manages while being willfully ignorant of the fundamentals.
mdellavo
·5 lat temu·discuss
https://stackoverflow.com/questions/3730019/why-not-use-doub...
mdellavo
·5 lat temu·discuss
What do you think about this being overall detrimental to code quality as it allows people to just blindly accept completions without really understanding the generated code. Similar to copy-and-paste coding.

The first example parse_expenses.py uses a float for currency - that seems to be a pretty big error that's being overlooked along with other minor issues around no error handling.

I would say the quality of the generated code in parse_expenses.py is not very high, certainly not for the banner example.

EDIT - I just noticed Github reordered the examples on copilot.github.com in order to bury the issues with parse_expenses.py for now. I guess I got my answer.
mdellavo
·5 lat temu·discuss
I would say the use of float makes it a nonstarter - even for "quick one-off" scripts. That's a fundamental error in the generated code. It maybe looks correct at a quick glance but it's only introducing subtle errors to find down the line.
mdellavo
·5 lat temu·discuss
in their own example the copilot aimed for the mountains with float() - thanks but no thanks
mdellavo
·5 lat temu·discuss
I guess I dont see the point if only 10% of the time it's exactly what you want and the rest of the time you have to go back and touch up the line.

Does it train a programmer for accepting less than ideal code because it was suggested? Similar to how some programmers blindly copy code from StackOverflow without modification.

Seems like there is a potential downside that's being ignored.
mdellavo
·5 lat temu·discuss
do you still go over the generated code line by line and touchup in places where it did not do a good job?
mdellavo
·5 lat temu·discuss
Should I be impressed that the example parse_expenses.py on the home page doesnt include any error handling and uses a float for currency? This seems like it's going to revolutionize copy and paste programming.
mdellavo
·6 lat temu·discuss
or the systems arent multi-tenant so they end up cloning the schema for each customer
mdellavo
·7 lat temu·discuss
facebook's solution https://facebookincubator.github.io/oomd/