• FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    0
    arrow-down
    1
    ·
    2 days ago

    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.

    • thingsiplay@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      2 days ago

      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.

      • GeirGrusom@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        1 day ago

        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.

      • FizzyOrange@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        2 days ago

        Just because import works different in the language than the ones you like, does not mean the language is crap.

        No, it means it’s unsuitable for scripting, if you need anything more than a single file. Better than Bash of course (not hard).

        • thingsiplay@lemmy.ml
          link
          fedilink
          arrow-up
          0
          arrow-down
          1
          ·
          2 days ago

          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.

          • FizzyOrange@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            2 days ago

            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.

            • thingsiplay@lemmy.ml
              link
              fedilink
              arrow-up
              0
              arrow-down
              1
              ·
              2 days ago

              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.