3 ms·
In Python if you carelessly print within a multiprocess part of an application you may end up getting a nonreproducible mess on stdout with multiple streams mer
by pama 3y ago
In Python if you carelessly print within a multiprocess part of an application you may end up getting a nonreproducible mess on stdout with multiple streams merged at random points. So the cognitive load in this example is that this new language is meant for multithreaded coding and can make multithreading easy compared to other languages.
- bmitc 3y agoThat's a great example of the "simplicity" of Python being anything but.
- int_19h 3y agoThis is not at all unique to Python, and a footgun present in any language that allows multiple threads. But if you're spawning multiple threads - in Python or any other language - you're already past any semblance of "simplicity", threads or no threads.
- bmitc 3y agoThat's a good point regarding print, however several other languages make multithreading easy. F#'s async is easy and just works as does Erlang and Elixir of course. Python's asyncio is barely even an async library, much less one that is simple.
- int_19h 3y agoF# async will not prevent you from causing data races. Erlang does by basically not having shared mutable data.
- bmitc 3y ago> F# async will not prevent you from causing data races. That's true regarding side-effects and mutable data, but I wasn't saying that. It's still a much more sane and actually concurrent and asynchronous library than Python's asyncio, which is not actually concurrent, single threaded, and very difficult to work with. For example, there's nonway to laumch an asynchronous process and then later await it from synchronous code, whereas it's easy in F#.