40 ms·
Care to share some highlights? Fifth to second sounds like a big difference!
by sadgit 11y ago
Care to share some highlights? Fifth to second sounds like a big difference!
- inglor 11y agoIt has the ability to statically check the type system, that's amazing. Moreover async/await with async resource management (which C# doesn't have yet) gives it a real edge for server development.
- ColinDabritz 11y agoWhat is async resource management? can you link to docs for the features you mean? I'm having trouble googling this one, maybe different keywords are used?
- 1st1 11y agoI think inglor refers to the new 'async with' statement: https://docs.python.org/3/reference/compound_stmts.html#async-with https://docs.python.org/3/reference/compound_stmts.html#asyn... Using it you can safely cleanup/commit transaction/release lock/etc when exiting a block of statements (even if an exception was raised). Plain 'with' statement cannot call asynchronous code in '__exit__' methods, 'async with' can do that (in '__aexit__').
- sadgit 11y ago> has the ability to statically check the type system I was under the impression that type checking was not one of the goals of PEP 484 etc.
- useerup 11y ago> Moreover async/await with async resource management (which C# doesn't have yet) In C#, the using statement combines with async/await. It is cool that Python finally gains proper async/await, there is no need to diss other languages.
- inglor 11y agoIDisposable's dispose is not an async function, there is no IAsyncDisposable interface with language support. There is however, a proposal https://github.com/dotnet/roslyn/issues/114 https://github.com/dotnet/roslyn/issues/114 , I'm not dissing the language but things are the way they are.
- jodah 11y ago> async/await with async resource management (which C# doesn't have yet) gives it a real edge for server development An edge over what? You're still limited to a single thread via the GIL. Until that problem is solved, Python is certainly not the best bet (all else aside) for server development.
- cben 11y agoNode.js is also single thread and has been doing fine on servers. Do you really need to share mutable state between threads in your server? If yes, what's your story when you'll need to scale to multiple servers? If not because you can keep shared mutable state in a separate service (DB or similar), you can deal with one-machine scaling very similarly to scaling across machines - just start/fork a process per CPU. You get simplicity, avoid the whole thread-safety can of bugs, and all the administration benefits of stateless servers.