8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions
comment 4y ago · link · parent
- whenever possible, do no harm
- do not let harm occur due to inaction
- when given a choice, preserve the most amount of healthy lifespan in aggregate
- higher lifeforms are more valuable than lower ones (cat vs lobsters)
- deferred consequence is better than immediate (since it opens the door to other later interventions)
It kind of really brings to bear how much of a thematic device the 3 laws are. There's no way to make them congruent with actual, messy, real-world situations. Also why the whole "self-driving car trolly problem" is a non-issue - there will never be a situation where the "AI" has nice neat consequences and a binary choice laid out in front of it. It's always going to be some collection of "preserve life as best as possible" heuristics.
comment 4y ago · link · parent
comment 4y ago · link · parent
As long as there is sufficient penetration of these black boxes, virtually everything should be able to talk to everything over v6, and the v4 shim can be removed.
I imagine this black box could be a relatively inexpensive ASIC or FPGA that could be a stand-alone widget, baked into hardware network adapters, or just built into routers, middleboxes, etc.
comment 4y ago · link · parent
https://github.com/Delgan/loguru
Also iirc s3's "file-like interface" does not actually obey the file protocol, which is obnoxious.
comment 4y ago · link · parent
comment 4y ago · link · parent
On top of that it definitely is in need of more top-down organization, delegation, and coordination.
comment 4y ago · link · parent
comment 4y ago · link · parent
There's been dozens of "replacements"/frontends/guis for git, off the top of my head: gitless, magit, tortoise git, gitkraken. Heres a whole mess of em: https://git.wiki.kernel.org/index.php/Interfaces,_frontends,...
> My second question is, if the underlying model is so f*cking elegant, how did it lead to such a confusing interface?
I think this is 66% because the operations are on the tree/nodes themselves, and not like, on "versions", branches, or some other skeumorphic abstraction. It's very bare metal. If you know how the command operates on the tree, you know how to conduct the actual action desired. I think the rest is due to cruft/familiarity - once you build that mental model, it works extremely well. So it's vi-like with a steep learning curve and arcane interface, but once you "git good", it's phenomenally productive.
comment 4y ago · link · parent
Honestly I prefer it over reading documentation and then having to mentally map to the codebase. I wish I could write this code well.
You sure you've actually read any of it, or did you just skim, see no docstrings, and decide it's crap?
comment 4y ago · link · parent
I really want a declarative solution like Rust's Clap library, but I haven't yet found anything like it out there.
comment 4y ago · link · parent
Text-to-image algos did the same thing for a while, but you look at the latest full-size DALL-E and it's pretty much flawless.
If I were considering art school, I'd certainly be reconsidering my options. Maybe there are some defects in the output, but nothing photoshop can't fix.
I think where humans win out (for now) is where a high degree of specificity/precision is needed (e.g. graphic design). Or certain legal requirements are present - AI art can't be copyrighted at this time - such as logo design.
comment 4y ago · link · parent
class Dependant:
def __init__(
self,
*,
path_params: Optional[List[ModelField]] = None,
query_params: Optional[List[ModelField]] = None,
header_params: Optional[List[ModelField]] = None,
What are path_params? They're params parsed from the URL path. What are query params? The same, from URL query component. Header params? Params pulled from the request headers. Shocking. If you actually sit down and read through FastAPI it's remarkably easy to get your bearings and start hacking around, despite the "no actual documentation" (I think type annotations count as documentation).Compare that to code bases like Django, Celery, Matplotlib, where it's kwargs, kwargs, everywhere and nary a type hint to speak of.
The number of open issues is due to the massive popularity of the library (46K stars) compared to the number of actual maintainers. Some actual questions on the Issues tab right now:
- How to add admin page? - Is safe to remove value from list in asyncio - Best practice to run FastAPI on Cloud Run with server port as $PORT
These are all n00b questions that could readily be answered with general-purpose resources, but this is the blight that super popular FOSS libs and their maintainers have to deal with.
comment 4y ago · link · parent
I don't see it that way. I see a rapidly growing library still in pre-1.0 and a BDFL trying to wade through a mountain of "contributions", a lot of them garbage, trying to keep code quality high in one of the most pristine and readable source code repos I've ever seen.
Also they have crowdsourced 17 languages for documentation translation. And it's up to date. That's bonkers. You're lucky if english documentation is accurate and up to date in many open source codebases.
comment 4y ago · link · parent
Obligatory...try Rust?
But actually, try python with mypy and mypyc. It's still a little experimental, but if you stick to simple constructs it works well, and you can compile straight python to fast, static libraries, without using goofy cython syntax.
comment 4y ago · link · parent
As long as your definition of "just works" is "run, crash, fix something, run, repeat". I remember the pre-type-annotation days, and still live it with some libraries. I find it quite unpleasant, but hey I guess some folks like the "freedom".
> So it's very easy to create code that passes the type checker, but fails at runtime or vice versa.
In theory, yes, in practice, not as much as you might think. If you actually use mypy with strict, which is actually really hard to do, you will find very, very few surprises.
comment 4y ago · link · parent
Well, yeah, because that's a compile-time check, not a runtime check. Use Pydantic if you want runtime validations.
> The new type system goes pretty much against the idea of duck typing,
It's very much orthogonal, due to the aforementioned distinction. Type annotations are compile-time. Duck-typing is run-time. You can still type-hint something and then call an attribute that isn't on the interface, and you can suppress the type error with `# type: ignore`. But also, if you know you are using quack(), you probably want foo(duck: Duck).
comment 4y ago · link · parent
Python style exceptions, pros:
- rapidly drop through layers when needed to get to a stable entry point - easy to add errors deep in the stack
Cons:
- basically a limited GOTO, therefore side-effect, therefore not composable - no way to know if what you are calling is gonna throw on you
Java pros:
- have to declare exception types, so at least you know what you are dealing with
Cons:
- you have to always declare exception types, which can be tedious - same non-composable GOTO-lite behavior - adding an exception deep in the stack is tricky
Go pros:
- errors are values, therefore typed and technically composable - no surprises
Cons:
- tedious, verbose - can't rapidly unwind unless you panic - rarely composable in practice, requires manual unwrapping in most cases - adding an exception deep in the stack is tricky
Rust Result pros:
- strongly, statically typed - no surprises - higly composable - can map over it - rapidly unwind in a composable way with ? operator
Cons:
- adding an exception deep in the stack is tricky (but often amenable to programmatic refactoring)
It's no wonder Rust is the SO most loved language 7 years running.
Python actually has a Result type library which I really like, but it's been hard selling my team, and you really need buy in. But I'd give it a swing.
comment 4y ago · link · parent
What this means is I can import my AppConfig class anywhere (except types and config submodules) without circular imports, construct them, and they will be initialized with the configs from the env.
Occasionally I have to bust out ForwardRef annotations and model.update_forward_refs() but that's pretty rare. Basically, the imports are structured so that it's as close to a DAG as possible.
Definitely check out pydantic, it makes it really easy to do 12-factor style application config.
I haven't done a lot with CLI-flag global config, but if I had to, I'd use something like dependency-injectors to wire it all together.
comment 4y ago · link · parent
Walrus is...fine. I don't use it much, but I defo see how it's one more thing.
Python's biggest complexity, imho, is its almost unrivaled dynamicism. There's just too many degrees of freedom at times.
The import system continues to be a nuclear footgun. I consider myself a python expert with 15 years under my belt and today I was still fighting with imports in a pytest suite. Like wtf.
comment 4y ago · link · parent
> TL;DR: Lay off virtual sugar, digitally detox, open the mind…
- appreciate interestingness
- hang out with geeks
- enjoy quietude
- get out of a rut
- read long form
- try three things you’d never, three times each
- regain a sense of wonder
> And remember, “Boring is as boring does!”This is all rather patronizing and has some major wowthanksimcured vibes. Yes, I can overcome the nonlinearity of the response of my dopamine receptors by simply laying off "virtual sugar" and doing a "digital detox".
Bottom line: different people have different neurotypes, and folks are allowed to be bored or stimulated to various degrees by whatever media, without attaching value to how easily one is entertained, or not.
comment 4y ago · link · parent
The new Dune is long, dense, cerebral, visually brilliant, but is paced way better in my opinion. There's a continuous forward drive.
De-emphasizing pacing is just as bad as de-emphasizing any other important facet of cinema. But we have this dichotomy that action is "cheap" and not as "smart", because it has wider appeal.
I think neurotype plays a lot into this. I have ADHD, and the snobby cousin comment about "digital detox" is exactly the elitist garbage that rubs me the wrong way. It attaches value to "not being bored" as if that's something I have control over.
comment 4y ago · link · parent