Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

The issue is that `check=False` by default for the `run()` function.


sort by: page size:

That's fine and all. But it runs without errors or warnings.

I can put that in main.py and do `python3 main.py` and it will simply run fine.

What is the point of this whole system if it's not enforced?


Every other line of my code is check_call. Could you expand on the issue you're observing?

I’ve found the opposite with pyright. Code that seems right but is failing checks is fixed with the next release :)

I gave chatgpt some python code and it told me that the loop would never execute, determined what was wrong with it and suggested a change which it then said would never terminate unless a check was added.

Thanks! The code is executed by an "host" script with a system call, not sure if this breaks the __main__ function in python. We will look into that issue. :)

You needed those checks anyway. Python is just making sure you don't forget.

It's really neat, I like it! It would be nice to catch exceptions, they are currently blowing up, i.e.: ``` ncaught PythonError: Traceback (most recent call last): File "/lib/python3.11/_pyodide/_base.py", line 460, in eval_code .run(globals, locals) ^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.11/_pyodide/_base.py", line 306, in run coroutine = eval(self.code, globals, locals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<exec>", line 7, in <module> File "<exec>", line 5, in feet_to_meters ZeroDivisionError: division by zero ```

If this is a problem for you, I recommend pylint. No need to rely on code reviews, and catches majority of cases like this.

(You’ll likely want to disable some of the more opinionated checks, but this is well documented and supported)


Python doesn't actually "compile" the code on each run. It only "recompiles" when something changes.

> wrong, even with py3.6

If it works, it works. I wouldn't worry until changing the interpreter. Who knows, you might be relying on some bug for correct functionality.


Really? That hasn't been my experience. Out of 20 python scripts, at least 50% have some error, some of which look right until you run them. A few involve hallucinations, like calling non-existent methods.

But that's why I say, there should be a pypy flag where you tell it to not double check at run time and that you've made sure your annotation is correct.

Now if it isn't correct, you'll probably get a segfault or some nasty error and it'll blow up.


Interesting. Are you sure it's the language and not the programming style? There doesn't seem to be a reason to prevent you from writing maintainable Python code.

The key problem seems to be `check_output` in the `subprocess` module.

Consing for control-flow is not normal, but on Python it is. Python - not even once.

In Python you have no guarantee that that function hasn't been monkeypatched over and replaced by some other library you imported.

A correctness check so quick, it didn't check correctness at all.

That is not how to decrease the complexity of reasoning about a Python program.

What you should do instead is break the program up into smaller microservices.


Are you using libraries that use `np.bool`? These could trigger warnings to stderr that you would see.

That has...nothing to do with python3 though, that's just your broken code being broken.
next

Legal | privacy