I’m not UlrikHD

  • 0 Posts
  • 54 Comments
Joined 2 years ago
cake
Cake day: September 19th, 2023

help-circle





  • While I agree to some extent, if not var is more than clear enough for anyone that knows python. If that pattern confuses someone, they probably aren’t at level where they should be dealing with python at a professional level. The same way you would expect people to understand pointers and references before delving into C code.

    This sort of stuff is something I taught first year engineering student in their programming introductory course, it’s just how python is written.

    For what it’s worth, it’s sort of similar in Erlang/Elixir. If you want to check if a list is empty, checking the length of the list is discouraged. Instead you would use Enum.empty?().







  • For example, how could it know whether cat $foo should be cat "$foo", or whether the script actually relies on word splitting? It’s possible that $foo intentionally contains multiple paths.

    Last time I used ShellCheck (yesterday funnily enough) I had written ports+=($(get_elixir_ports)) to split the input since get_elixir_ports returns a string of space separated ports. It worked exactly as intended, but ShellCheck still recommended to make the splitting explicit rather than implicit.

    The ShellCheck docs recommended

    IFS=" " read -r -a elixir_ports <<< "(get_elixir_ports)"
    ports+=("${elixir_ports[@]}")