24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions
https://www.bitecode.dev/
Email: contact at bitecode.dev
comment 6y ago · link · parent
If currently the designer is not working on the same project than the dev, they should not be in the same scrum.
Keep it short, to the point.
Scrum is not a meeting, it's an interactive tiny bite of field report.
Make it anything bigger than that, and you are not doing agile anymore.
comment 6y ago · link · parent
Coroutines are not functions, they are coroutines. Different primitives.
A function has a single exit entry point and a single exit point and no state. If you call a function, you run its body.
A coroutine has several entry points and exit points, and an internal state. If you call a coroutine, you make an instanciation (the body doesn't run).
You can argue than using coroutine for async handling has drawbacks, but colored functions is not the proper analogy and make people very confused about the whole thing.
The fact the syntax to define them is so similar doesn't help, and I see most people difficulties comming from their attempt to reconciliate models that have no reason to be.
Just like a hashmap and an array are 2 different things despite you can index both, functions and coroutines must be understood as separated concepts.
comment 6y ago · link · parent
In fact there are not function at all, just like generators are not.
Also coroutines can be called from functions and vice versa. You don't have to choose.
The problem is not the color. The problem is the default paradigm is to be blocking I/O, and you add non blocking on top. It's way easier to make everything non blocking, then add blocking things on top.
It's not a matter of syntax, but of core paradigm.
Go and erlang were designed from the non blocking perspective from the get go.
But even go add to use something to manage async control flow, so it uses channels, which you don't need if you have coroutines.
Erland went deeper and made everything immutable, and baked in actors in the runtime. To me that's more impressive.
comment 6y ago · link · parent
Just like there is still good music today.
The problem is discovering it.
Before internet became a medium for mass sharing pictures of inspiration quotes and kitten, blogs had a change to stand out.
Now, theyr are completly dwarfed by other usages, and most users don't find it a popular format anyway. Search engine rarely put them in top of search results either, because they rarely quickly answer and direct question or provide the popular untertainment du jour.
So if you want to help bring blog back, you gotta find a way to make them more visible, and get people interested in them.
Good luck with that. Videos store instantly became more popular than libraries IRL, and I don't see a reason why suddenly blogs would win against Youtube. Same with equivalent to Facebook, Twitter, etc.
comment 6y ago · link · parent
Wait, what?
So you have an completly black box ultimatum, and even if you somehow magically guess what needs to be done, if you do it, they can still reject you?
That's worse than debugging IE6.
That's dishonest.
comment 6y ago · link · parent
Before 3.7, you had to be able to fetch the loop, handle its reference, pass it around, manage its life cycle, etc.
Starting from 3.7, only low level code (E.G: framework authors) would need to, the API is organized so that by default, you always perform something in the current running loop.
It's a big deal, and remove a ton of complexity. Maintenance is easier, learning curve is flatter.
The best example, is that in 3.6 and lower, you had to do "loop = asyncio.get_event_loop()", then call "loop.run_until_complete()". In 3.7, you use asyncio.run(). It seems trivial, it's really not:
https://github.com/python/asyncio/blob/db2fe1d1e1d0f7352167a....
This has consequences on the whole design, which is now full of things like that (run_in_executor, create_task, run_forever, etc), changing completly the way to write correct code.
Another thing is that in 3.7, the asyncio uses async / await and not yield from. Because of this dog fooding, the whole lib improved.
3.7 has a LOT of patches just for asyncio: https://docs.python.org/3.7/whatsnew/changelog.html#python-3...
Speed (Future has been rewritten in C, and many other tweaks), fixes, _way_ better doc...
Obvious shortcomming were resolved, like asyncio.wait_for() that now waits until the cancellation is complete, or asyncio.all_tasks() returning only pending tasks. A lot of little things that add up.
The whole ergonomics are better, up to the command line experience with "python -X dev" which automatically add warnings and set asyncio in debug mode, and frankly you can't cleanly code async without.
The final nail in the coffin are the context vars (https://docs.python.org/3/library/contextvars.html). It's the only sane way to deal with a global registery that is dependant of the current running task.
It's almost always easier to upgrade to 3.7 than trying to use asyncio before it.
comment 6y ago · link · parent
comment 6y ago · link · parent
You can provide the async behavior using any solution you want: threads, io event loop, subinterpretters, subprocess...
It can all be called from async / await.
In fact, if you use asyncio, the lib, it provides mechanisme to await from threads, subprocess.Popen, and multiprocessing pools.
comment 6y ago · link · parent
You have to balance "one obvious way to do it", "saying relevant" and "backward compatibility".
We broke compat once in 25 years to stay relevant with I/O, and gave 13 years to migrate.
And still, it was an outrage.
Let's see what Go looks like in 2034.
comment 6y ago · link · parent
gen def stuff()
Because it doesn't, people are very confused about generators, and think they are functions, which they are not. They are completely different objects.
Plus there is no way to tell if a definition is a generator without reading all of it.
Explicit is better than implicit and all that.
comment 6y ago · link · parent
async def foo() is not a function and it doesn't have the same signature: the async is very explicit.
It's a different primitive, and it's not used AT ALL for the same thing at a function.
It's like writting:
def foo():
yield "bar"
and saying, 'how do you cal that function? How do you know how to call that function? It's called the same thing. It has the same signature.. It returns the same thing. One has one exit point, the other has several. This is "colored functions".You have to call the 2nd one like:
next(iter(foo()))
It's absurd'Well, no, it's not. It's a different tool. It's not a function, it's a generator.
You don't have to care about async/await. In fact, you can live your entire life without using them.
But it's a handy tool that allows you do:
- delegate asynchronous behavior, like I/O, outside of your callable
- make you match the syntaxic order with execution order despite said delegation
- make it clear and explicit where you chose to do so, indentifying the context switching of your program
Does it seems complicated ? It's because it is, and you probably don't need it.
But if you need it, it's easier than the alternative of using callbacks, and less error prones that implicit asyncronicity.
comment 6y ago · link · parent
I mostly still use the same features I used 10 years ago. And so do most of my clients.
But occasionally, I have the option to go the extra mile, and use asyncio for perfs or type hints for robustness.
The language grew big, but you don't feel it on the day to day coding.
comment 6y ago · link · parent
async / await are just primitives, they are, in no way, incompatible with the rest of Python code.
At worst, if you mix blocking and non blocking, you loose the performance benefit, that's all. It all works. You are just back to non async execution.
You can use async functions in sync code and vice-versa.
In fact, you can use async / await for asyncio, or another lib, or no lib at all, it's a completly lib agnostic concept. It doesn't even need any io. async / await is just a "yield from" which understands __await__.
It's an interface. A contract. Like generators.
What's more, the python community is now following the best pratice of creating Sans I/O libs (https://sans-io.readthedocs.io/), which means you can plug in whatever I/O lib you want.
There is a lot of confusion around asyncio, partly because of the communication and doc around it, partly because it sucked up until python 3.7, and partly because a lot of python devs have absolutely no need for it and see it from the point of view of their day to day task.
But it's definitly not fiasco, it's quite a handy tool, and the generic interface of async / await is nifty and allows cool designs.
comment 6y ago · link · parent
There is currently a project to abstract the C-API with HPy: https://speakerdeck.com/antocuni/hpy-a-future-proof-way-of-e...
The idea is to (very slowly) remove access to direct CPython internals and give a handle to important low-level behavior through a standardized API hidding implementation details.
It's a lot of work, and going to affect a huge part of the ecosystem, but I'm hopeful this is something the extensions authors will actually want to be part of because it promises to solve a lot of problems:
- on the long run, this will make maintaining a c-extension much easier: more stability no matter the evolution of upstream, more certainty.
- there will be a clear way to do things, which means better documentation and conventions, potentially libs to do common things. Right now creating extensions is more a set of receipes people found out to work.
- because of this, scrutiny will be given to common patterns, which will be abstracted and optimized, and given the security of an API contract
- extensions using this API will work out of the box, or faster if they already did, on alternative python implementations like pypy
Of course, the end goal is to free the python core devs to experiment with breaking changes at the c level, such as changing the memory management model, and eventually maybe remove the GIL or allow for a JIT.
comment 6y ago · link · parent
And those don't use $LATEST_TECH, $FANCY_FRAMEWORK or $EXOTIC_LANGUAGE.
They use $BORING_TECH, $OLD_LANGUAGE, $DEPRECATED_FRAMEWORK.
They are not in the cloud, don't update often, have to deal with legacy stacks, stacked on a stack of legacy stacks, and administrative burden from left to right.
Those are the ones that pay for an Oracle licence, and sync it to dozens of excel sheets from an FTP and a lone Access DB, where all auth is manage by a Tomcat service actually proxying to Active Directory and their custom CRM.
And they certainly don't have a team of 10x programmers. In fact, most are windows dev that never used the terminals and don't have admin rights on their machine.
I should know, I make half of my income going from company to company to train their team.
They are everywhere.
They make billions.