24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions
https://www.bitecode.dev/
Email: contact at bitecode.dev
comment 4y ago · link · parent
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
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
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
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
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
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
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
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
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
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
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
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.