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 4y ago · link · parent

Being stabbed with a knife could kill you.

Could.

comment 4y ago · link · parent

Yes, and very few people use that because most users can't tell an app from a website, spell URL correctly or tell you what "" does in google.

When I need those features I use the operators directly in the search field anyway.

The single omniscient search field is an amazing interface, it's incredible at what it does, which is understanding what our idiodic human brain is attempting to express with sausage fingers a monday morning.

comment 4y ago · link · parent

Oh but this comment is part of a thread. Because comments are in a context. Like this one, from 6 hours ago:

https://news.ycombinator.com/item?id=32763171

comment 4y ago · link · parent

Well, asbestos has obvious benefits. It's an amazing, cheap way to insulate things, and it's very resistant to fire.

We knew abestos was dangerous even before the WW2, and kept using it because it was so convenient.

That's the thing about know-it-all neo-ludditism pithy dismissals. They started 30 years ago witha much more soft tone. But since not only people ignored the warnings, but eventually even came to insult the people performing said warning (even after the warning proved to be true), the same people turned kinda sarcarstics.

Poor you to have to read a rational argument in a comment using history and logic to underline our societies shit where they eat and ignore the asymetry of risk.

Sacarstic people are mean and don't understand how to have quality discussions. They should always stay perfectly calm and neutral while they feel like half of the population is setting us up for troubles.

comment 4y ago · link · parent

Indeed, accountant predictions usually end up being true.

comment 4y ago · link · parent

The whole reason SV exploded was that people were doing things instead of waiting for the theory to show it can work.

That's how software has innovated for 30 years: by practice.

Giving a price to an economist, the opposite of somebody practicing and producing, is a signal something is going wrong.

comment 4y ago · link · parent

And that's "if used correctly".

Now add passion, alcohol, nails, wrong lubricants, and ignorance for a much worse rate.

comment 4y ago · link · parent

Apple is much better at marketting than Google, Facebook or Microsoft.

comment 4y ago · link · parent

Sure.

Because 3 letters agencies never, ever had backdoors in popular systems. It's not like the US had an illegal massive secret cabale dedicated to mass spying on its own population after all.

Luckily, Apple plateforms are notoriously open so it will be easy to check. It's great that we don't have to take their word for it after they lied about not being part of any PRISM-like program.

Anyways, all that doesn't matter much. Why would it be a problem when the economy, climate, international politics and the democracy are so stable these days? I can't see any reason why history would repeat and powerful entities would abuse any power they get.

Somebody who thinks like that would be a crazy tin hat conspirationist, and not at all a concerned citizen.

No, only the part of the population ready to spend hundred of dollars on an upgrade to get copy/paste must be capable of rational thinking. Anybody else is biased.

comment 4y ago · link · parent

Condoms effectivement is 98%: https://www.nhs.uk/conditions/contraception/male-condoms/

If you have sex twice a week (which for a young couple is very conservative), after a year, you've reach 100 attempts already.

You then better hope the two patners agree on wether or not keeping the baby.

comment 4y ago · link · parent

Ah, tracking the entire population even in the highest mountain and the deepest desert.

And all that to protect your love ones, of course.

People apparently forgot all about PRISM already. That didn't take long.

comment 4y ago · link · parent

Provided we grow as much as we cut, and let the ecosystem regenerate where we cut. Which is a huge if.

comment 4y ago · link · parent

Maybe, but one can find out. You can follow the chain of calls of any software, and they have access to everything, as well as the whole history.

It's like when in an interview Buffets says it's very hard to know where all the money is in the financial system.

Sure, it's a complex system, but it's more of a matter of incentive.

comment 4y ago · link · parent

I don't read it that way. Quite the opposite, upwardbound is offering an opinion that is not against meat, and therefore, being vegetarien just signals it is rooted is thinking and not dogmatism.

comment 4y ago · link · parent

The project looks nice, and I will certainly follow it.

But the author expresses way too much confidence in the description of the project. It has no test, no type hints, no pluggable error handling, not fall back when the redis instance dies, and has been used in prod by apparently a single entity.

Stating "WakaQ is stable and ready to use in production" is irresponsible, as a task queue is critical infrastructure and this could lure devs into thinking this code is way more mature than it is.

Of course, one should do due diligences when evaluation a new part of the stack. I also appreciate the enthousiasm of the article, and I'm sure the code already procudes many benefits for the author.

But no, a asynchronous execution system dealing with priority, resiliance and network messages, that have existed for a month, is in no way stable and ready. It's nascent and promising.

comment 4y ago · link · parent

Then I wouldn't call it distributed, since it's centralized on redis.

Otherwised good product.

comment 4y ago · link · parent

I believe the parent comment agree with you and is mentioning he is vegetarians so that answers focus on why fishing makes it's easy for slavery given there are abuses in agricultures as well.

Thank to this, he was able to ask a question that was uneasy to ask, and get the answer about international waters, making it an interesting addition to the whole thread.

comment 4y ago · link · parent

Thanks, now I could read it entirely.

comment 4y ago · link · parent

Yes, or just an option to hide the slides.

comment 4y ago · link · parent

The format of the article, and it's unwillingless to go to the point made me quit reading half way. Even in reader mode the flow of reading is interrupted every 2 lines by a large useless image or some snarky comment from the author.

Too bad, it's an interesting topic.

comment 4y ago · link · parent

"attempt to reproduce" then. Because a lot of those studies cannot be reproduced, that's the point.

comment 4y ago · link · parent

For me (windows, chrome or ff), it works only on the blue markers, but zooming on the map does not make it more details, and the switch to street view leaves a blank canvas.

comment 4y ago · link · parent

* Conditions apply. Use the comment in the context of the HN bubble, and ignore that a huge part of the industry is still deploying wordpress on VPS, using excel spreadsheets for database and gmail for bug tracking.

comment 4y ago · link · parent

Yes, if you don't need the logger, it is indeed cleaner.

comment 4y ago · link · parent

Right, I misread the code, my bad.

For this case, one should use a nested comprehension:

    space = ((r, c, cell) for r, row in enumerate(table.rows) for c, cell in enumerate(row))
    for (r, c, cell) in space:
        if search_query.matches(cell.value):
            logger.info("Found cell: (%s,%s)", r, c)
            return (r, c)
Or see masklinn comment if you don't need the logger.

In all languages, you separate code for preparing your input and code for processing it. In python, it's also a good idea to do that at the loop level:

- prepare your stream of data so that it's normalized using itertools, generators, a function, a numpy array, etc

- do a single loop pass for your processing

This way you will you obtain a single iterable, and will be able to get the most out of the language tooling:

- you can pass it to map/filter, itertools or another comprehension

- you can convert to a list, a tuble, a Counter, etc. And slice it

- you can use "else" in the loop, which is an underused construct, but very useful when you need break

- you can use advanced unpacking

- you can call iter() and/or next(). This is what masklinn does in his example.

The point being, nested loops are rare enough, and we have tool to deal with them in an idiomatic way in Python, and not adding new syntax for a rare case that usually has a good solution makes sense to me.

comment 4y ago · link · parent

Itertools is your friend:

    from itertools import product

    for x, y in product(a1, a2):
        if test(y):
            break
Not only you get the behavior you want, but you get an easier to read code with one less level of indentation. Bonus, you can now use "else" (which most people don't know can be used with "for" and not just "if").

Why introduce a new syntax when a library does the job? A new syntax is a huge bar to pass for a language, and nested loops are rare.

Itertools is a gem, and any python dev will benefit greatly from mastering it.

comment 4y ago · link · parent

The first loop would catch it, it would not reach the next. But you can indeed use any exeption. However, itertools.product does a better job.

comment 4y ago · link · parent

Python has had itertools.product for ages for this use case.

comment 4y ago · link · parent

EDIT: made a mistake, see my next comment bellow. I won't update this comment so that other readers can see the code for the 2 use cases.

Python has itertools.product and unpacking for this case:

    from itertools import product

    space = product(enumerate(table.rows), enumerate(row))
    for (r, row), (c, cell) in space:
        if search_query.matches(cell.value):
            logger.info("Found cell: (%s,%s)", r, c)
            return (r, c)
Note that we don't need the "found" variable neither to get the same beheavior. We can also use break + else, but in this case, the return is cleaner since that's the default value for python functions. Additionnally, the logger should do the interpolation, not format().

I think the Python team is having to do the difficult job of filtering new feature, and it makes sense they don't introduce it in this case. We already have all the facilities in the language to deal with most nested loop cases, and those are rare cases anyway.

comment 4y ago · link · parent

Nassim Taleb famously destroys those lines of reasoning in his books: game theory is unpractical for most people, because it almost always ignore variables that don't exist in a lab but are crucial IRL.

Comments have been explaining which ones already apply to this article, I'm not going to repeat them.

But there is an another example from Taleb that always makes me smile:

- If the other player tosses a coin and gets 9 tail in a row, what are the chances of getting tail on the next toss?

- 50%!

- No, 100%. The other player is cheating.

1
888990
184