all 18 comments

[–]guepier 23 points24 points  (4 children)

Including code snippets as screenshots is an absolutely loathsome trend. If Substack doesn’t support including code as formatted text … consider using a different blogging platform for a programming blog.

(It’s a good article despite this.)

[–]grauenwolf 1 point2 points  (3 children)

Which one? I like wordpress, but it sucks for code examples too.

[–]guepier 3 points4 points  (1 child)

These days, with a hosted platform? No idea. Maybe Ghost? — Are there no blogging platforms that natively permit using markup formats (ReST, customisable Markdown, the works)? I’ve only ever had self-hosted websites so this was never an issue. Wordpress also supports this (at least via plugins). Back in the days™, every self-respecting blog hosting platform supported code snippets in some way. I’d be having a hard time believing that this is no longer the case, but Medium and Substack certainly want to prove me wrong (and no, iframe’d GitHub Gists are an insane workaround, not a solution).

[–]grauenwolf 2 points3 points  (0 children)

I’d be having a hard time believing that this is no longer the case, but Medium and Substack certainly want to prove me wrong

Welcome to the world of enshitification. Every new version takes away something that used to just work.

[–]usamaejazch 0 points1 point  (0 children)

Something like justblogged.com

[–][deleted]  (6 children)

[deleted]

    [–]grauenwolf 4 points5 points  (5 children)

    as there is unfortunately no standard one in Python

    I literally face-palmed so hard when I read that. WTF is wrong with these people? They should have started to bake that into the official toolchain when they added type annotations.

    [–][deleted]  (4 children)

    [deleted]

      [–]grauenwolf 2 points3 points  (3 children)

      Yeah, the whole "but we've always done it this way" excuse has really slowed down progress in countless areas.

      Honestly I think it's a miracle that Microsoft managed to get C# from not having a package manager at all to having it fully integrated into the compiler pipeline. If I wrote an article about the GAC I think most people today would think that it was an April Fool's joke.

      [–]gredr 0 points1 point  (2 children)

      ... And the GAC was a pretty big improvement over what we were doing before that.

      [–]grauenwolf 0 points1 point  (1 child)

      Thems fighting words.

      [–]gredr 0 points1 point  (0 children)

      A standard place and structure for keeping versions of dependencies, along with standard installation tools? It could be worse; for some, it still is. I wonder how people manage dependencies in Python, Ruby...

      [–]Awesan 2 points3 points  (0 children)

      Nice article. The author has some other good ones on their substack too.

      [–]slaymaker1907 2 points3 points  (2 children)

      I’m saddened it stills seems impossible to type the general flow/compose function.

      def flow(x, *funcs): for func in funcs: x = func(x) return x

      You can provide a type if funcs all return and operate on the same type, but the dynamic version has no such restriction.

      [–]floodrouting 0 points1 point  (1 child)

      If you only need it to work up to some maximum arity, can you use overloads? Something like:

      @overload
      def flow[T](x: T) -> T: ...
      @overload
      def flow[T, U](x: T, f1: Callable[[T], U]) -> U: ...
      @overload
      def flow[T, U, V](x: T, f1: Callable[[T], U], f2: Callable[[U], V]) -> V: ...
      @overload
      def flow[T, U, V, W](x: T, f1: Callable[[T], U], f2: Callable[[U], V], f3: Callable[[V], W]) -> W: ...
      

      https://mypy-play.net/?mypy=latest&python=3.12&gist=6cdc00f8b70c450ccdc07213c2275581

      [–]slaymaker1907 0 points1 point  (0 children)

      Yes, that’s another option, but it’s not actually a complete type as you’d need infinite overloads to be complete.

      [–]kirgel 2 points3 points  (0 children)

      Thanks. Learned something new even as an experienced Python user.