Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
masklinn
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
36 ms
·
931.
▲
by
masklinn
2y ago
> db.execute will always need to accept a string. No. A t-string with no placeholders is perfectly fine. You can use that even if you have no parameters.
932.
▲
by
masklinn
2y ago
Yes?
933.
▲
by
masklinn
2y ago
Using a t-string in a db.execute which is not compatible with t-strings will result in an error. Using a t-string in a db-execute which is, should be as safe as using external parameters. And using a non-t-string in that context should (eve
934.
▲
by
masklinn
2y ago
> Aren't there other benefits to server-side parameter binding besides just SQL-injection safety? For instance, using PG's extended protocol (binary) instead of just raw SQL strings. Caching parameterized prepared statements, e
935.
▲
by
masklinn
2y ago
> Please engage with my point instead of criticizing trivialities. Your complete misunderstanding of what's happening is not a triviality. > The essential difference is that the language is referenced at the declaration site, not
936.
▲
by
masklinn
2y ago
Except your labels are incorrect because neither `html_string` nor `sql_string` are strings, they're both Template objects, and the sink function is the one which processes it. No processing has happened to them by the end of the snipp
937.
▲
by
masklinn
2y ago
The JS version actually desugars to something much more primitive, and less convenient: in JS a template tag receives one parameter which is an array of n+1 strings, and then n parameters for the interpolated values, and has to iterate alte
938.
▲
by
masklinn
2y ago
Because t-strings don't create strings, so if the library doesn't support t-strings the call can just error.
939.
▲
by
masklinn
2y ago
> Fair enough. It would be nice if Python allowed to customize the formatting options after `:` It does, the `Interpolation` object contains an arbitrary `format_spec` string: https://peps.python.org/pep-0750/#the-in
940.
▲
by
masklinn
2y ago
t-strings allow building APIs which don't accept strings at all (or require some sort of opt-in), and will always error on such. That's the boon. Having to write cr.execute(t"...") even when there's nothing
941.
▲
by
masklinn
2y ago
Same as currently: the library provides some sort of `Identifier` wrapper you can apply to those .
942.
▲
by
masklinn
2y ago
dmurray was comparing a hypothetical sql"..." with sql(t"..."). There are no %s either way.
943.
▲
by
masklinn
2y ago
A t-string is a literal for a Template object which is a data holder, it doesn't actually do anything, so you would simply call bar(t"zoop")
944.
▲
by
masklinn
2y ago
> However, I have a hard time imagining any developer who would both make such fundamental errors with f-strings currently and also switching to this option when it ships. t-strings are a different type (both static and dynamic), f-strin
945.
▲
by
masklinn
2y ago
That's... already the case of t-strings?
946.
▲
by
masklinn
2y ago
This was considered and rejected: https://peps.python.org/pep-0750/#arbitrary-string-literal-p...
947.
▲
by
masklinn
2y ago
IIRC there are mine trucks set up similarly in some locations, they're loaded at the top, regen downhill, and that's sufficient to power them back up the hill when empty.
948.
▲
by
masklinn
2y ago
> The bottleneck for free range was always the battery - which was solved by the mobile phones. I wouldn't say solved here. Significantly improved into usability yes, but there are still big issues with batteries: - their low energy
949.
▲
by
masklinn
2y ago
The hydrogen economy never had anything to do with academics. It's a fallback plan by the oil industry.
950.
▲
by
masklinn
2y ago
Yep, hybrid trolleys / battery trolleys are really cool, as they provide the flexibility of batteries to e.g. work around roadworks and blockage, but allow for a more distributed electricity consumption thanks to partially fixed routes
951.
▲
by
masklinn
2y ago
FWIW rasn linked above claims to support UPER, but I couldn't tell you how completely.
952.
▲
by
masklinn
2y ago
AI crawlers are a plague, they are intentionally badly behaved and designed to be hard to flag without nuking legit traffic. That’s why projects like nepenthes exist.
953.
▲
by
masklinn
2y ago
Not just Europe either. Tokyo was not named after the Tokyo Motor Vehicles Ltd.
954.
▲
by
masklinn
2y ago
> it's the people who can't afford to live in the city who need them to get there. What are you talking about. Paris's public transport reaches out 60km away from the city, and that's not including mainline trains (in
955.
▲
by
masklinn
2y ago
> There are cities not designed around cars. We just call them "rural." You could not have had your urban city without cars. That is literally the opposite of reality.
956.
▲
by
masklinn
2y ago
> Both systems pushed the clock rate much higher than PCs at the time. Intel reached 3.2GHz on a production part in June 2003, with the P4 HT 3.2 SL792. At the time the 360 and PS3 were released, Intel's highest clocked part was the
957.
▲
by
masklinn
2y ago
> Studios didn't sit down and train up new teams of devs on how to maximize the cell architecture. Yeah usually only first party studios have the time, money, and access for that (Naughty Dog being a prime example thereof in the Son
958.
▲
by
masklinn
2y ago
That's part of the failure in developer mindshare: leveraging SMT for games in 2005 was difficult enough, heterogeneous multi-ISA hardware, a ring bus, and the peculiarities of the SPEs made the PS3 not really a consideration. Things m
959.
▲
by
masklinn
2y ago
> also i dont understand why ps3 is considered a failure, when did it fail? > The PS3 failed developers It failed as an ISA (or collection thereof), and in developer mindshare.
960.
▲
by
masklinn
2y ago
`str.format` allows the format string to navigate through indexes, entries, and attributes. If the result of the formatting is echoed back and any non-trivial object it passed in, it allows for all sorts of introspection. printf-style... do
More ›