4 ms·
I have to disagree regarding asyncio. If existing code uses it that you need to interface with, your sensible options are basically to rewrite all of your code
by meowface 7y ago
I have to disagree regarding asyncio. If existing code uses it that you need to interface with, your sensible options are basically to rewrite all of your code to use asyncio, or try a hacky third-party library that'll try to bridge them.
I'm personally not a fan of it (I'm still a gevent proponent; Go seems to be doing fine with a green thread model), but a lot of libraries I use are written with it, so it's pretty annoying for me. That and the dependency/package story are the two things that've made me seriously consider switching to a different language. (The article's complaints about things like pre-commit and isort are pretty silly and irrelevant, IMO, though it would be nice if there was something official like "go fmt".)
So far the benefits still outweigh the costs for me, compared to other languages, but I predict a better, cleaner, and more performant successor to Python may come this decade. If it does, I think I might become an early adopter.
- pdonis 7y ago> I have to disagree regarding asyncio. If existing code uses it that you need to interface with, your sensible options are basically to rewrite all of your code to use asyncio, or try a hacky third-party library that'll try to bridge them. Yes, this is true. I don't think there's a lot of existing code using it at this point since it's still a fairly new feature. But of course that will change as time goes on. > I'm personally not a fan of it I haven't tried it yet in an actual project, but my initial reactions just looking at the specifications and examples were mixed. I like the idea of the await keyword to label call sites where your code might be suspended, but I don't like having "async" cluttering up function definitions, for loops, and with statements. The way generators were handled when they were first introduced in Python 2 was much cleaner IMO: one new keyword, yield, and any function that had that keyword in it automatically became a generator. I don't see why a similar rule couldn't have been implemented for the await keyword: any block with await in it automatically becomes an async block.
- meowface 7y agoI do find the mandatory "async" peppering everywhere annoying, but I'm honestly not a fan of the whole paradigm. I don't actually think it's that important to explicitly specify "await" when you want to await. It's also extremely prone to obscure, frequently-missed errors; a missing await or unnecessary/incorrect await can affect performance or logic in a massive way.