Better HN
topnewbestaskshowjobs
Log inSign up

ReflectedImage

476 karma · joined May 12, 2020 (6y ago) · 570 submissions

Submissions

comment 4y ago · link · parent

If you enforce them then you can't do duck typing, this means adding lots of boilerplate code to your code base, increasing the amount of bugs, since bugs are proportional to the total number of lines of code in the project.

Typing related bugs that aren't caught in unit testing are very rare.

comment 4y ago · link · parent

I don't think Numpy is mostly written in Python. It's C.

So using type hints to annotate your flask api, etc. to generate docs is great. No problem.

The issue is that there have been a lot of Java developers switching to Python and they want to pretend that Python is a statically typed language (and use tools like MyPy) because it's more familar to them.

Python is not a statically typed language and treating it as one leads to terrible results. Especially in large projects.

The issue of course if that the Java developers have no point of reference on what a successful large Python project looks like. So they think they are doing great with MyPy when if you compare what they are outputting to a proper large Python project, it's pretty clear they are doing terribly.

When you use Python properly you write self contained microservices. Typing information exists but only on the external interfaces e.g. API. You also don't share business logic code between the self contained microservices because that massively decreases the maintainabily of the overall system. You show your Python code is correct by using Unit Testing and Mocking.

Basically, there is a way to do large Python projects and MyPy (and other static type checking tools) have no place in that story. It only exists to support people in making bad decisions on their codebase.

comment 4y ago · link · parent

I've seen Python projects using Monorepo MyPy and Python projects using Microservices.

Python Microservices style when it comes to code quality, maintainability, etc... wipe the floor with Monorepo MyPy style projects. It's not even close.

comment 4y ago · link · parent

In my personal experience codebases using MyPy tend to be considerably worse than codebases that don't.

By using a static type checker on a dynamically typed language, you have admitted you don't know what are you doing right of the bat. This means the software engineers in the project are very bad and therefore the code quality overall will also be bad.

Tools like MyPy exist to make Python appear to be more like Java to help Java developers, who aren't willing to learn how to code in a different programming paradigm.

That code will always be far worse than Python code written using the Python development paradigms.

comment 4y ago · link · parent

Monorepos require static typing as a first class citizen of the language.

"And there is nothing wrong with using a type checker for your Python type annotations."

There is a lot wrong with that. Python is a dynamically typed language. If you are using a static type checker on a dynamically typed language, you are not taking advantage of the dynamic nature of the language.

You are basically not writing Python code at all. This means you get all the disadvantages of using a dynamically typed language with none of the benefits.

In summary, you have a made a very poor engineering decision.

comment 4y ago · link · parent

Using type checking in Python is always the wrong thing to do. You need to learn to use Microservices where you split up a large code base into seperate 3k lines Microservice chunks of code that interact over well documented APIs.

That's just how effective Python is done.

comment 4y ago · link · parent

Basically, they screwed up by using a monorepo with Python and have decided to try and badly paper over it by using a type checker.

For reference, don't do either of those things in Python.

comment 4y ago · link · parent

Well I'm in a corp style place. The haircut was done by rolling dice. And whilst my number didn't come up, I wouldn't be so sure that's it's good for any involved.

comment 4y ago · link · parent

You do need microservices because when when parts of you system are badly written or the requirements change, etc, etc..

You can just shoot a couple of the offending microservices dead and replace them with better implemented versions.

[Assuming there are at least 6 developers]

comment 4y ago · link · parent

More colors the better! Right?

comment 4y ago · link · parent

The work behind what3words isn't the algorithm. It's the word list used. They have linguistics who check the sounds of words, are they too similar to another word are they rude, etc, etc..

comment 4y ago · link · parent

Programmers advance by job hopping. There is more budget for attracting new talent than retaining old talent. It's sad but true.

comment 4y ago · link · parent

Solving the climate crisis with Future Tech is nice and all, but the word "future" does have a meaning.

More practically, we should we be building the last generation of nuclear reactors to cover us for the next 50 years until the Future Tech actually exists.

comment 4y ago · link · parent

The maths used in economics is widely known to be wrong.

When informed the maths in economics is wrong, the economists don't go and fix their maths either.

Economics is more like sociology with some random incorrect formulas written on the black board as set dressing.

Economics might in self loathing claim they are the "dismal science", but the cold hard truth is they simply speaking are not doing their jobs properly. It's a broken research field.

comment 4y ago · link · parent

Python has domain on web backend, statistical stuff and data analysis nowadays.

comment 4y ago · link · parent

Well if you choose Python/Ruby you only need 1/3 of the developers as if you choose another language.

The productivity gain is so great it outweights everything else. It's as simple as that.

comment 4y ago · link · parent

The changes you need to make to a Python program to enable it to be type checked result in more bugs being added than the type checker removes leaving you at a net negative.

Type checking is just a really poor way to ensure program correctness until you start using an exceptionally strongly typed language like Haskell.

You use types in C / C++ / Java because the compiler needs them to work not because it's a good idea.

comment 4y ago · link · parent

The bad practice is treating a dynamically typed language as if it was a statically typed language.

There are shorter more concise ways to write your programs if you are not using static typing.

If you are not writing your Python programs in the Pythonic way then you are not really using Python correctly and you do not get most of the benefits of the language.

Unit tests exist for catching bugs in Python. Type hints are for documentation not for ensuring code correctness.

Yes, there are libraries that take advantage of type hints, through they could of used other annonations and it's valid to use type hints along with those libraries.

But as soon as you are attempting to prove your program doesn't have bugs via typing rather than unit testing. You have gone wrong.

Typed Python is far more bug prone, why? Because structuring your Python code to support typing means writing considerably more lines of code.

It not the type hints themselves but it's the way you will structure your program at a high level to support them.

The more lines of code the more bugs it has. Bugs are well known to be proportion to the number of lines of source code regardless of language used or whether the language is typed or not.

comment 4y ago · link · parent

Typing in Python is generally a code smell.

Typing encourages a large number of bad coding practices. If you can apply typing to a Python program then you are not taking advantage of the dynamic nature of the language to write simpler and shorter code.

In Python world, unit tests cover what is normally handled by typing.

comment 4y ago · link · parent

If you can use a Domain Specific Language (DSL) for a task, or in this case a Domain Specific Modelling Language (DSML), why wouldn't you use one?

It's no different from using SQL for database access.

Basically, someone has to do a ton of upfront work designing a domain specific language for a task, in this case game scripting then it's easier for people to do the game scripting using the domain specific language than using a general purpose language.

SQL is an early example of a language designed for a specific purpose.

comment 4y ago · link · parent

Yes, but they would take more like 80% rather than the 10% they do today.

comment 4y ago · link · parent

Surely, they would just group together then just take stuff from rich people?

The moral lesson, would be not to play unfair games.

comment 4y ago · link · parent

The usage of dynamic typing gets rid of a lot of boiler plate code and over complicated designs. Python code that doesn't use typing is generally better than Python code that does.

comment 4y ago · link · parent

A Python code bases trustworthiness depends on it's unit tests. If you are using type hints for that, you have seriously gone wrong.

comment 4y ago · link · parent

Using typing in Python is a code smell. Lack of understanding of what the language is for and how to use it.

comment 4y ago · link · parent

This is an obvious troll by the way. Given the username on GitHub of who raised this issue.

comment 4y ago · link · parent

Clearly, they had to ship the oven before they could write the convection roasting software. With a quick 240 GB download your oven will be fully working until patch v1.1 next month.

comment 5y ago · link · parent

Ahh but it already passed the test ROMs at the point I turned to printf debugging.

comment 5y ago · link · parent

I wrote a GB emulator, the main issue was debugging it. Subtlely wrong tends to lead to game crash very quickly.

The trick I used was to take an existing GB emulator, add a printf debugging statement to print out each current instruction and the registers. Add the same printf statements on mine. Then use diff on the outputs of both emulators.

It does play Pokemon. The emulator is called FireGB.

comment 5y ago · link · parent

In the UK it is widely known to be utter trash.

Here's a song about it written in 2010: https://www.youtube.com/watch?v=5eBT6OSr1TI

Song's punchline: "It's absolutely true because I read about it in the daily mail /s"

1
1516171819