My rule of thumb is if it uses more than one variable, an if statement, parameter expansion, or string interpolation I just write it in python with argparse and file input.
Much cleaner, easier to reason about, and self documenting.
Bash and Python are very different. Bash uses your system as programming language, while Python offers a lot more. Python is in many cases a good solution that does not need extra work for programming languages to compile. If you don’t think that Python is a grown up language, then you seem to be misinformed.
I think his point was that Python is more useful for one-off stuff and I’d claim that much better than bash at those kinds of things.
But Python has so many quirks and bad designs. Function scoped variables, multiple inheritance, backwards comprehension syntax, poor pattern matching, poor handling of None and so much is convention based so you don’t get an error if you did it wrong. Python classes aren’t serializable (not even data classes).
Coupled with it’s awful performance I’m convinced the reason people use it is because they don’t know anything else.
Python may be a grown up language but it’s still a pretty awful language for ad-hoc scripting. It really wants to believe that you only use it for writing Python projects damnit! You can beat it into submission, but as soon as you start typing import in a situation that isn’t a nice pure Python package it will say “whatchulookinatmate? Youwannafight?”
Don’t believe me? Explain how relative imports work.
I write Bash, Python and Rust. And I love writing in Python. It helped me so much and prefer it over almost any compiled language. Bash is completely different beast and not a replacement for Python and vice versa. Just because import works different in the language than the ones you like, does not mean the language is crap. For any questions about the import system, have a look at https://docs.python.org/3/reference/import.html#package-relative-imports .
It depends on how you use the language, as a scripting like language or a full replacement for compiled languages. I personally don’t build packages with Python. BTW you can even compile Python scripts to binary machine code, and I don’t mean bundles, but real compilation process. It even speeds up the performance of the program.
I write C# and Python, and C# is much more expressive than Python is and performs about 10x to 77x better. C# has much better pattern matching and has operators to deal with null and support for it in the type system. C# records can be serialized without issue (Python’s built in JSON serializer can only serialize dictionaries). Althoigh variable scoping in C# isn’t perfect (object patterns in if statements pollute the outer scope) variables at least aren’t just function scoped like in Python. You can define user defined primitve types in C# which enables bettrr support for domain typing than what is possible in Python.
Python is good for scripting. If you start importing and having multiple packages involved with relative imports, that’s no longer “scripting”. We have standard library and the package manager for a reason. I think you are conflicting with full fledged applications and scripting.
There are plenty of things that are “scripting”, i.e. ad-hoc admin of other projects that aren’t actually Python projects, where you want to share code between multiple scripts.
For such important projects, its not a big deal to just create Python packages. I don’t get your point. You can use Python for scripting, and you can use it for full fledged programs or share package dependencies.
My only problem is, that non standard package dependencies need to be installed by the end user, or sometimes the Python version does not match. These are the biggest issues to me.
AI needs feedback just the same as humans. I would think of AI like a human that’s of average cleverness, but has a huge breadth of knowledge and basically infinite time and patience. They are going to be decent at assembly but they’re still going to make mistakes just like humans.
Using a language like Rust that has a lot of static correctness checks gives a higher quality result for AI, just like it does for humans.
AI doesn’t need feedback – you’re supposed to write “make no mistakes”. Why are you worrying about “static correctness checks” when AI can just write flawless assembly?
Rust is pretty great in almost all domains. The only ones where I think Python is a sensible choice are research, where a REPL is really useful (think Jupyter).
the stdlib of rust is woefully lacking, proper error handling is way too verbose, the dependency chains are massive and unauditable, and all the implicitness makes it hard to reason about stuff like a.from() without proper editor support which makes code review a nightmare. i do like ccontract-driven design though. all in all i think i’ll stick to zig if i need safety.
My rule of thumb: If I wouldn’t write it in bash, I won’t write it in Python. Anything more serious gets a grown up language
My rule of thumb is if it uses more than one variable, an if statement, parameter expansion, or string interpolation I just write it in python with argparse and file input.
Much cleaner, easier to reason about, and self documenting.
I’ve started rewriting some stuff in Go, bash is just not a pleasant experience in my opinion
Ha ha ha ha ha ha
Bash and Python are very different. Bash uses your system as programming language, while Python offers a lot more. Python is in many cases a good solution that does not need extra work for programming languages to compile. If you don’t think that Python is a grown up language, then you seem to be misinformed.
I think his point was that Python is more useful for one-off stuff and I’d claim that much better than bash at those kinds of things.
But Python has so many quirks and bad designs. Function scoped variables, multiple inheritance, backwards comprehension syntax, poor pattern matching, poor handling of None and so much is convention based so you don’t get an error if you did it wrong. Python classes aren’t serializable (not even data classes).
Coupled with it’s awful performance I’m convinced the reason people use it is because they don’t know anything else.
Python may be a grown up language but it’s still a pretty awful language for ad-hoc scripting. It really wants to believe that you only use it for writing Python projects damnit! You can beat it into submission, but as soon as you start typing
importin a situation that isn’t a nice pure Python package it will say “whatchulookinatmate? Youwannafight?”Don’t believe me? Explain how relative imports work.
I write Bash, Python and Rust. And I love writing in Python. It helped me so much and prefer it over almost any compiled language. Bash is completely different beast and not a replacement for Python and vice versa. Just because import works different in the language than the ones you like, does not mean the language is crap. For any questions about the import system, have a look at https://docs.python.org/3/reference/import.html#package-relative-imports .
It depends on how you use the language, as a scripting like language or a full replacement for compiled languages. I personally don’t build packages with Python. BTW you can even compile Python scripts to binary machine code, and I don’t mean bundles, but real compilation process. It even speeds up the performance of the program.
I write C# and Python, and C# is much more expressive than Python is and performs about 10x to 77x better. C# has much better pattern matching and has operators to deal with
nulland support for it in the type system. C# records can be serialized without issue (Python’s built in JSON serializer can only serialize dictionaries). Althoigh variable scoping in C# isn’t perfect (object patterns in if statements pollute the outer scope) variables at least aren’t just function scoped like in Python. You can define user defined primitve types in C# which enables bettrr support for domain typing than what is possible in Python.No, it means it’s unsuitable for scripting, if you need anything more than a single file. Better than Bash of course (not hard).
Python is good for scripting. If you start importing and having multiple packages involved with relative imports, that’s no longer “scripting”. We have standard library and the package manager for a reason. I think you are conflicting with full fledged applications and scripting.
There are plenty of things that are “scripting”, i.e. ad-hoc admin of other projects that aren’t actually Python projects, where you want to share code between multiple scripts.
For such important projects, its not a big deal to just create Python packages. I don’t get your point. You can use Python for scripting, and you can use it for full fledged programs or share package dependencies.
My only problem is, that non standard package dependencies need to be installed by the end user, or sometimes the Python version does not match. These are the biggest issues to me.
Yeah anyway with AI why would you use Python for a new project? I just do everything in Rust now, including simple scripts.
Unfortunately there’s a lot of existing Python code.
Why bother with rust? Just tell it to write assembly
Assuming that’s a genuine question…
AI needs feedback just the same as humans. I would think of AI like a human that’s of average cleverness, but has a huge breadth of knowledge and basically infinite time and patience. They are going to be decent at assembly but they’re still going to make mistakes just like humans.
Using a language like Rust that has a lot of static correctness checks gives a higher quality result for AI, just like it does for humans.
AI doesn’t need feedback – you’re supposed to write “make no mistakes”. Why are you worrying about “static correctness checks” when AI can just write flawless assembly?
i just write the critical parts in c and glue them together with python, because if it’s one thing it’s good at it’s ffi.
Do you have a codeberg? I’d love to see how you use c and python together
it’s all work stuff unfortunately. it’s just basic ctypes stuff though.
Why bother with the significant pain of FFI when you can just write the whole thing in Rust?
Also “the critical parts” is mostly a myth. After a small amount of optimisation, the vast majority of programs do not have nice isolated hotspots.
because i need my programs to be dynamic and scriptable?
Rust has scripting support. It’s nightly only but that’s not actually a big deal since running nightly is trivial.
It has some limitations currently, but… so does Python.
it’s just such an odd question. you know nothing about my domain or my requirements, you just assume i can or want to use rust.
Rust is pretty great in almost all domains. The only ones where I think Python is a sensible choice are research, where a REPL is really useful (think Jupyter).
the stdlib of rust is woefully lacking, proper error handling is way too verbose, the dependency chains are massive and unauditable, and all the implicitness makes it hard to reason about stuff like
a.from()without proper editor support which makes code review a nightmare. i do like ccontract-driven design though. all in all i think i’ll stick to zig if i need safety.