Better HN
topnewbestaskshowjobs
Log inSign up

BiteCode_dev

24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions

I write to save you time and effort when dealing with Python:

https://www.bitecode.dev/

Email: contact at bitecode.dev

Submissions

comment 6y ago · link · parent

And you are not suppose to have the entire rugby team in the scrum, only people who's work intersect.

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

It's like calling classes colored functions because you can both call them. Classes are not functions. They are classes.

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

That's the benefit of integrating async in the runtime itself. It abstracts it from the language, which doesn't have to know about it. Just like a GC abstract memory handling.

comment 6y ago · link · parent

Async def are not colored functions in python.

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

Blog never went away. There are plenty of it, and very good one.

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

> Apologies to Pushbullet for the rejection after addressed the original violation

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

Swift is already way more popular than dart though.

But Swift doesn't run on Android, does it?

comment 6y ago · link · parent

And yet there are people complaining it's too slow, or too fast.

I don't think there is any pace of language evolution that will never be criticized.

comment 6y ago · link · parent

Compose, rarely. Read and edit with plain text editor, it's common.

comment 6y ago · link · parent

Not async in general, but asyncio in particular.

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

A single source of trust for the dependancy transport.

comment 6y ago · link · parent

How did you deal with C-extensions, since apparently most don't support it at all (which is a shame, apparently we messed up culturally here).

comment 6y ago · link · parent

There are plenty of things that could have been down, but the Python core dev team is small and very resource limited.

comment 6y ago · link · parent

See HPy for another solution to that: https://speakerdeck.com/antocuni/hpy-a-future-proof-way-of-e...

comment 6y ago · link · parent

Read the other comments and people says it moves too fast.

People are never happy.

comment 6y ago · link · parent

Spwaning the process is not the only problem, communicating between them is also expensive.

comment 6y ago · link · parent

async / await is just a protocol to delegate async behavior outside of your control flow.

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

Python was first released in 1991. It's older than Java. It existed before internet or multi-core was common.

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

I have the opposition opinion. I think generators should have had an explicit keyword for defining them, like:

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

> How do you know how to call that function?

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 think that the beauty of Python is that is still Python.

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

> Python code doesn't even work with Python code

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

Yes, that's why the work has to start ASAP.

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

Is there a Tor alternative to reddit?

comment 6y ago · link · parent

Oh yes, there are tons of giants creating software for health applications you never heard of, defense purposes you cannot hear about, logistic you would never consider (managing competitions, port services, private jet traffic, truck fleets...) and so on.

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.

comment 6y ago · link · parent

Yes but they don't have specialized hardware and have the highest power consumption constraints.

comment 6y ago · link · parent

"virtual" is the keyword. They do some magic to not calculate or store most of it, most of the time.

comment 6y ago · link · parent

Yes, and he doesn't care.

comment 6y ago · link · parent

That's a joke, and Beazley don't accept PR anyway.

comment 6y ago · link · parent

David Beazley usually does that, and also refuses PR.

He is interested in providing PoC (like with curio), but not doing what comes after.

1
165166167
184