Better HN
topnewbestaskshowjobs
Log inSign up

kortex

8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions

Submissions

comment 2y ago · link · parent

That's just reflection. That's a feature of code, not language runtime. I think there are some languages which in fact have type checking in the runtime as a bona-fide feature. Most won't, unless you do something like isinstance()

comment 2y ago · link · parent

Many uses. There's tons of situations where you are already accelerating most of your heavy compute with tensor libraries, but the data input/output parts are still in python. They would benefit from loading data in parallel before batching.

Multiprocess, OS threads, and asyncio all solve different problems. Threads are pretty heavyweight compared to async coroutines (aka green threads). The big win with coroutines is it is very cheap to put them to sleep waiting on io. So a web server on a 4 core vm might have 4 worker processes, several threads per process, and dozens/hundreds of coroutines.

> So perhaps you can use this for slurping other people's IP in parallel and train the "AIs" that are supposed to make us redundant.

This has absolutely nothing to do with the technical merits of async or threads. For one, the above two examples are taken directly from work I did to combat deep fakes by identifying various "tells" from the media. Some of us are in fact using machine learning for good.

comment 2y ago · link · parent

s/will never be/already is/g

https://github.com/mypyc/mypyc

You can compile python to c. Right now. Compatibility with extensions still needs a bit of work. But you can write extremely strict python.

That's without getting into things like cython.

comment 2y ago · link · parent

That's true of most compiled languages. Unless we are talking about asserts, reflection, I think type erasure, and maybe a few other concepts, language runtimes don't check types. C does not check types at runtime. You compile it and then rely on control of invariants and data flow to keep everything on rails. In python, this is tricky because everything is behind at least one layer of indirection, and thus virtually everything is mutable, so it's hard to enforce total control of all data structures. But you can get really close with modern tooling.

comment 2y ago · link · parent

Nope. Type annotations can be executed and accessed by the runtime. That's how things like Pydantic, msgspec, etc, do runtime type enforcement and coercion.

There are also multiple compilers (mypyc, nuitka, others I forget) which take advantage of types to compile python to machine code.

comment 2y ago · link · parent

https://github.com/python/mypy

> Python itself doesn't do that

The type syntax is python. MyPy is part of Python. It's maintained by the python foundation. Mypy is not part of CPython because modularity is good, the same way that ANSI C doesn't compile anything, that's what gcc, clang, etc are for.

Mojo is literally exactly the same way, the types are optional, and the tooling handles type checking and compilation.

comment 2y ago · link · parent

> when pip is only for Python

That's the neat part, it's not! You can distribute basically any kind of data with pip, within reason. Iirc Cmake can be pip-installed.

comment 2y ago · link · parent

It probably started with Zipf's law in the 1930s and then Murphys law a few years later.

comment 2y ago · link · parent

Has there ever been an attack/leak based on time metadata in UUIDs/ULIDs/Snowflakes/etc (not sequential), in a domain outside of sensitive ones (HIPAA/healthcare, defense)?

I'm skeptical that for the vast majority of uses, have time data in the IDs (and also not leaking it from actual timestamp fields) is an issue, and for the cases where it does, just use random IDs.

Even theoretically, is there a way to translate timestamps into a German tank problem? If I give you a sampled set of timestamps (with no other node identifiers), can you estimate the cardinality of the greater dataset?

comment 2y ago · link · parent

Many TUIs (text user interface) with multiple operations will show one bar reach 100% and move onto the next process (or show multiple in parallel).

If the UI automatically transitions to a totally new screen after completion, I'm never going to see 100% anyways, unless the app does the exact infuriating thing in TFA, which is render 100% (at 99.whatever) and then do some fsync/cleanup and actually be frozen showing 100% which is the contrapositive of oddly satisfying, it's unsurprisingly unsatisfying.

comment 2y ago · link · parent

What's stupid about it?

Dig was an early and widespread DNS CLI tool. "dog" is a logical name for a next-gen dns cli, and of course that exists. "Doggo" is both a pretty standard linguistic drift pattern of English slang (random -> rando, weird -> weirdo), a common internet term of endearment for "dog", and a logical derivation of *-go for go-based tools and software.

comment 2y ago · link · parent

Yes it was python but that has nothing to do with it. Same would happen in go, rust, R, or matlab.

Correct answers: 1.0, 0.0, 1.0

Confidence from algo: 1.0, 0.0, n/a

Confidence on the wire: 1.0, 0.0, 0.0

Score after bug: 66%

Score as it ought to be scored: 100%

It was enough to make several algorithms which were very selective in the data they would attempt to analyze (think jpg vs png images) went from "kinda crap" in the rankings to "really good"

comment 2y ago · link · parent

I believe this is the article:

https://www.ajaonline.org/article/3863

> In July 2014, we conducted a survey of Pompeii’s street network to document traces of iron that were observed on the stone-paved streets, which resulted in the identification of 434 instances of solid iron and iron staining among the paving stones. ... Pompeians were—in addition to using solid iron wedges—pouring molten iron and iron slag onto their streets as a method of emergency repair.

There's a huge gulf of difference between "a civilization is capable of melting iron" and "molten iron is so cheap and easy they used it to fill potholes".

Castable iron: Valuable, scarce, energy intensive, very hard to melt (comparatively), corrodes readily (especially on the coast)

Iron and other metal slag: Byproduct of iron smelting, basically waste, melts fairly easily, was used as ballast in ships, comparatively cheap, rusts superficially but is mostly a matrix of oxides which don't meaningfully react

I'm beyond skeptical that perfectly good cast iron was used to fill potholes. Using slag/dross/failed smelts/other byproducts of metallurgy makes far better sense.

It would be like far future archeologists unearthing rammed earth tire walls and concluding "the 20th century was so efficient at producing rubber they used excess tires as a building material" vs "they used a waste product which would have been landfill anyways".

comment 2y ago · link · parent

I think part of the confusion is that food anaphylaxis isn't automatic death sentence in all cases, but the risk is that it could be. I have a peanut allergy and carry an epipen. I've been exposed ~5 times in my life but it never was severe enough to deploy it, and instead took benadryl and closely monitored it with epipen in hand and 911 on speed dial. I also know people who eat their allergen occasionally because they just get hives and it's worth it as a treat, and I know people who had severe asthma in minutes after a cross-contamination and needed the epi.

It's just game theory. It's like asking how many metaphorical empty barrels do you want to add to your Russian roulette revolver before you are willing to risk it, the reward being basically "ordinary food". Oh and the risk can suddenly one day go from just causing hives to severe anaphylaxis at a much smaller dose.

Most people who learn of a sensitivity (I learned in elementary school after breaking out in hives from doing art involving peanut shells, the horror to think this is something schools just did!) just don't want to know that badly how dire their allergy is and assume it's life threatening, because it's not worth it to be cavalier.

comment 2y ago · link · parent

Any time you have a scalar/measurement number, basically any value with physical units, counts, percentages, anything which could be in the denominator of a ratio, those are all strong indicators of a "semantic zero" and you really want to tell the difference between None and 0. They are usually floats, but could be ints (maybe you have number_of_widgets_online, 0 means 0 units, None means "idk".)

comment 2y ago · link · parent

0 as a default for "no int" is tolerable, 0.0 as a default for "no float" is an absolute nightmare in any domain remotely related to math, machine learning, or data science.

We dealt with a bug that for weeks was silently corrupting the results of trials pitting the performance of various algos against each other. Because a valid response was "no reply/opt out", combined with a bug in processing the "opt out" enum, also combined with a bug in score aggregation, functions were treated like they replied "0.0" instead of "confidence = None".

It really should have defaulted NaN for missing floats.

comment 2y ago · link · parent

We also used to lock away basically any form of ASD or neurodivergence too far outside the norm (either directly via mental institutions, or indirectly via other harmful programs, mistreatment, or junk science). We also used to consider homosexuality a mental disorder. Moving forward is what society does.

Addiction is largely driven by neurodevelopmental disorders (ADHD, ASD, MDD, sleep disorders, and many more), psychological disorders (anxiety, OCD, and many more), or both in combination. Most folks don't want to be addicts. At the heart of addiction is executive dysfunction caused by the above conditions, exacerbated by stressors. You treat it like any other mental health problem: therapy, medication, support systems, and a society that cares for its populace.

comment 2y ago · link · parent

> This view of the world must be stamped out. It is a totally absurd viewpoint and I'm really tired of pretending it's not.

This is very argumentative and shuts down the discourse before it even begins. It's not very in the spirit of HN.

comment 2y ago · link · parent

Regardless of your stance on nuclear energy, can we all agree that articles of the form of "Person X of Authority Y dismisses Z as unviable" is a non-headline? It's basically "Person of vaguely adjacent qualification has opinion". I see it everywhere and it's the "cures cancer (in vitro)" of engineering articles.

comment 2y ago · link · parent

Looking forward toward somebody hooking together Python in APE [0], something like pex [1]/shiv[2]/pyinstaller[3], and the pants build system [4] to have a toolchain which spits out single-file python executables with baked-in venv and portable across mainstream OSes with native (or close enough) performance.

0 - https://news.ycombinator.com/item?id=40040342

1 - https://docs.pex-tool.org/

2 - https://shiv.readthedocs.io/en/latest/

3 - https://pyinstaller.org/en/stable/

4 - https://www.pantsbuild.org/

comment 2y ago · link · parent

A sufficiently clever convention is indistinguishable from magic.

comment 2y ago · link · parent

Is this just a form of continuation passing style? I get that it's a bit functional-y, and more complex that typical go code (admittedly a very low bar), but I don't think it's too bad. It's no worse than async generators in python, and it's downright elementary compared to anything template metaprogramming.

I don't mind the pace that Go has been moving at when it comes to new features. It still feels very conservative while still evolving.

comment 2y ago · link · parent

> largely importing foreign weapon system designs for local manufacturing.

I'm pretty sure they legally can't "largely import foreign weapon designs". The Berry and Kissel amendments, not to mention ITAR and a few other regulations, put a strong incentive on in-sourcing when at all possible. The only exceptions are for things that are really hard to get domestically.

comment 2y ago · link · parent

Seconded, though I've found the HF Hercules wired line pretty comparable to Dewalt.

But there's a fair amount of inter-model variety within those four/five brands. My 12v Dewalt impact punches above its weight/price and I have two Bosch 18v drills, similar in form factor but one is frankly inferior quality.

comment 2y ago · link · parent

Sounds like GP is suggesting digitally encoding/modulating the audio bitstream, like using the speaker as a modem. Which would be far less lossy than trying to record the analog signal.

comment 2y ago · link · parent

> Most languages (including Python, AFAIK) unwind the stack when an exception is thrown, all the way up to the nearest catch.

You might have to use a few tricks/hacks, but I'm pretty sure you can set up python in a way to breakpoint at an exception, including all local state at the throw site. Otherwise pdb would not work.

comment 2y ago · link · parent

It's not every day you come across Gnostic stuff on HN, but those links are super fascinating, I can't wait to check them out!

Zoroastrianism is such a fascinating topic.

comment 2y ago · link · parent

This might have been true a few years ago, but these are all solved problems in 2024.

> Python is not easy to build into portable binaries

https://pex.readthedocs.io/en/v2.1.40/buildingpex.html

- The package ecosystem is very hard to use in a reproducible way

pip, virtualenv, and requirements.in/txt is extremely reproducible. I will offer that it's not exactly idiot-proof yet and there are tons of stale tutorials out there

> The language is not truly typed - types add massive value for infrastructure and scripts because they are less likely to be unit-tested

Yes it is, if you want it to be. There's nothing stopping someone from using mypy, pyright, or other type tool on the strictest setting, and not passing builds unless you have 100% type coverage.

> The lack of a "let" or "var" keyword makes simple programming errors more likely (again, this code is less likely to be unit-tested)

No, but you get ~95% of the safety guarantees by using immutable-esque objects like @dataclass(frozen=True), pydantic models with the same, or attrs/cattrs with similar setting.

comment 2y ago · link · parent

Microsoft actually funds a lot of cpython work and 3rd party libs, IIRC they have played a big hand in the recent speed improvements, JIT work, the pyright type checker, and a bunch in the AI/GPGPU space like ONNX.

Dropbox has historically done a lot for python, idk how current that is. Netflix has a huge python codebase but I'm not sure what they contribute.

1
678
85