Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
maleldil
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
20 ms
·
601.
▲
by
maleldil
2y ago
PEP-8 says 4 spaces. No one should be using tabs.
602.
▲
by
maleldil
2y ago
There are quite a few services that use generative models to generate quizzes from YouTube videos.
603.
▲
by
maleldil
2y ago
> - Everything except C now has standard strings, not just arrays of characters. Zig's strings are null-terminated arrays of bytes. It's an unfortunate mistake from an otherwise interesting language.
604.
▲
by
maleldil
2y ago
That's not really true. In my experience (London), the trains are on-time more often than not.
605.
▲
by
maleldil
2y ago
I'm not taking the perspective of anyone here because there's hardly any information for me to do that. You're the one that has constructed this whole scenario in your mind based off very little from OP's post.
606.
▲
by
maleldil
2y ago
You have zero context other than what they said. What about withholding judgement about things you know nothing about before saying people are bad? The full story is likely much more complex.
607.
▲
by
maleldil
2y ago
I don't think the end user is the one making the choice to use MS Teams.
608.
▲
by
maleldil
2y ago
If I understand correctly, this sounds like https://github.com/simonw/files-to-prompt/ . It's quite useful, with some filtering options (hidden files, gitignore, extensions) and support for Claude-style tags.
609.
▲
by
maleldil
2y ago
Isn't that because you didn't have a good package manager to handle these? If you have a package manager that allows you to add packages from Git repos, why would you use submodules?
610.
▲
by
maleldil
2y ago
If your projects and libraries are public, your package manager will likely let you use Git references (usually commits/branches/tags) to define dependencies. I find that cleaner than submodules.
611.
▲
by
maleldil
2y ago
Not OP, but on Firefox 132, Sonoma 14.4, M1 Pro, it's quite janky. It's less so on Chrome and Safari, but it's still noticeable.
612.
▲
by
maleldil
2y ago
If you're using simple pipes with little control flow, bash is a great choice. Once you need something more complex, you're better off using something else. Not necessarily Python (Ruby and JS work well as replacements, too), but
613.
▲
by
maleldil
2y ago
Better to immediately switch to Python (or anything else) once you have any non-trivial control flow in your bash script. Loops, non-trivial conditionals, and argument parsing are all easier in Python. Bash is for simple scripts that just c
614.
▲
by
maleldil
2y ago
I meant that I can't sleep 8 hours and feel rested. If I'm forced to sleep less than I need, I'd be sleepy and tired all day. Taking a nap helps but isn't always possible, and is even less time efficient.
615.
▲
by
maleldil
2y ago
Why would it be an advantage? Aren't you "losing time"? I need 10 hours every day, so even if I go to bed at 10pm, I'd wake up at 8am, which is "late" for most people. I'd love to be able to wake up at 6am
616.
▲
by
maleldil
2y ago
> there are plenty of other languages that support that way of working I'd use them if I could, but I'm trapped in Python for several reasons. If I could use Rust, Ocaml, etc., I'd do that. But my choice is between untyped
617.
▲
by
maleldil
2y ago
ParamSpec doesn't have the same objective as what they're saying. The sibling comment shows how you can get the proper types in TypeScript and use them as types for other functions. On the other hand, ParamSpec is a hack to proper
618.
▲
by
maleldil
2y ago
Writing `body: list[AstNode]` lets you statically know what elements you'll get when you do `body[i]` or iterate over it. If you don't specify the type, you don't know what you're getting, and you have to rely on always
619.
▲
by
maleldil
2y ago
> Python used to be described as "executable pseudocode" And that's never been true once you're past toy examples into real-world programs. I agree that type hints are "ugly" to read, but they make the code
620.
▲
by
maleldil
2y ago
While that works (and I use it extensively), it's a bit hacky. You have to use `object.__setattr__` to set attributes in `__init__` or `__post_init__`, which looks so wrong.
621.
▲
by
maleldil
2y ago
C++ has extensive type inference now (C++20): #include <string> auto func(auto x, auto y) -> auto { return x + y; } auto main() -> int { auto i = func(1, 2); auto s = func(std::string(
622.
▲
by
maleldil
2y ago
Do you have any examples? What kind of changes were there?
623.
▲
by
maleldil
2y ago
This is the relevant bit: > The redundant types are deprecated as of Python 3.9. However, while the aliases may be removed at some point, removal of these aliases is not currently planned. As such, no deprecation warnings are currently i
624.
▲
by
maleldil
2y ago
Something I didn't see mentioned much here is refactoring. Refactoring without types is like walking in the dark. You have to check everywhere to see how your changes impact other code, and you'll certainly miss some and only find
625.
▲
by
maleldil
2y ago
> What is missing is mainstream adoption in libraries which is a matter of time. I don't think that's a big problem anymore. Between typeshed and typing's overall momentum, most libraries have at least decent typing and th
626.
▲
by
maleldil
2y ago
> people who use type hinting are just letting me know they have written code that doesn’t check in line. Yes, that's the point. We use typing so the type checker can find the mistakes for us instead of adding `isinstance` everywher
627.
▲
by
maleldil
2y ago
Use pyright in strict mode, then. If you really want runtime checking, you can Pydantic's validation decorator, typeguard or beartype. Current typed python is much better than people give it credit. You just have to use it properly.
628.
▲
by
maleldil
2y ago
The old stuff never stopped working, though. You can still use Optional, Union, TypeAlias, and import collection protocols from typing. You don't have to migrate if you don't want to. They're not even deprecated.
629.
▲
by
maleldil
2y ago
You can use TypedDict from `typing_extensions` if your version doesn't have it. You can use a lot of the newer stuff from there, too, especially if you enable `__future__.annotations`. How old is your Python, though? TypedDict is from
630.
▲
by
maleldil
2y ago
> I recommend against trying to use Emacs bindings in Vim if you can help it This is fine, I think. Using C-w is more convenient than <Esc>diw. I also find C-a and C-e quite convenient, although you need plugins for these (tpope&#x
More ›