There are a few I’m aware of:

  1. Rust-style use (multiple imports per statement, renaming items using as)
  2. Java-style import (single import per statement, no renaming (afaik))
  3. Zig-style let xlib = @import("xlib") (imports as assignments)
  4. C-style #include (no importing, just pastes the code of the named file)
  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    19
    ·
    3 days ago

    In order or preference, out of the ones I’m familiar with:

    1. Java. Very simple. Diff friendly. Import names match the filesystem.
    2. Rust. Also good - you can do it diff friendly though nobody does. Slightly confusing distinction between module hierarchy and filesystem.
    3. Python. Pretty bad. Conflates third party packages with local files, almost nobody actually understands relative imports, even more confusing distinction between module hierarchy and filesystem. Module imports can have side effects. Unnecessarily different syntax between import... and from .... import....
    4. C/C++. Obviously this is the worst.
    • kureta@lemmy.ml
      link
      fedilink
      arrow-up
      6
      ·
      3 days ago

      Well, I have been using python for a long time and was ready to disagree with you but damn, it really do be like that.