Recent submissions

Comment · 1 year ago
Comment · 2 years ago
Comment · 2 years ago
It actually depends!

`bytes.decode` (and `str.encode`) have used UTF-8 as a default since at least Python 3.

However, the default encoding used for decoding the name of files use ` sys.getfilesystemencoding()`, which is also UTF-8 on Windows and macos, but will vary with the locale on linux (specifically with CODESET).

Finally, `open` will directly use `locale.getencoding()`.

Comment · 2 years ago
Comment · 2 years ago
> strings having an encoding and byte strings being for byte sequences without encodings

You got it kind of backwards. `str` are sequence of unicode codepoints (not UTF-8, which is a specific encoding for unicode codepoints), without reference to any encoding. `bytes` are arbitrary sequence of octets. If you have some `bytes` object that somehow stands for text, you need to know that it is text and what its encoding is to be able to interpret it correctly (by decoding it to `str`).

And, if you got a `str` and want to serialize it (for writing or transmitting), you need to choose an encoding, because different encodings will generate different `bytes`.

As an example :

>>> "évènement".encode("utf-8") b'\xc3\xa9v\xc3\xa8nement'

>>> "évènement".encode("latin-1") b'\xe9v\xe8nement'

Comment · 5 years ago
Does it not come down to the usual "cathedral vs. bazar" opposition? SQLite, for which Fossil was originally built, lists 3 persons on its developers page and looks pretty much like the definition of a "cathedral", whereas git was built by Linus Torvalds for Linux, which is the prototypical bazar project.

It makes sense when you have a small team of people that know the project very well to record everything, and they can easily maintain stringent standards, like never committing anything that breaks the tests.

Whereas for a big project that involve thousands of people mailing patches around, some of them first time contributors, you'd rather make sure that what ends up in the immutable log has is clean enough.

Comment · 5 years ago
Ever read a good book, or played a video game, and known that you have to stop now but thought "I'll just read another chapter / play one more turn"?

I would say that's basically how addiction manifests itself: even if you know that you're dealing with substance abuse, come on, one more time won't matter, will it?

And then there's also the comfort aspect: you're getting back from a hard day's work, you're feeling tired and cranky, you do deserve something nice, don't you?

N.B.: I'm not saying that not being able to drop the book or stop playing that game IS addiction, just that substance addiction might feel the same way.

N.B. 2:And I'm not talking here about the medical aspects of withdrawal, because that's not the thing an addict would usually experience (withdrawal would only happen because you're trying to stop or cannot get access to the substance you need).

Comment · 6 years ago
Comment · 9 years ago
The article also says that 1500 police homicides a year accounts for 8 to 10 per cent of all homicides. The corresponding figure in Germany is less than 0.3 %
Comment · 9 years ago
Comment · 9 years ago
It could. In France (which has a mixed system), single payer cover around 70% of prescriptions costs. And you usually have an additional private plan that will cover the rest (and if you're too poor to buy one of these plans, you can be eligible to get it from the state).
Comment · 9 years ago
Wow, my Saturday afternoon just disappeared.
Comment · 10 years ago
"They take ID photos of 1856 Chinese men [...]. Half of these men were criminals."

Because half of the general male population is criminal, of course.

The accuracy rate would be very different with a training/testing sample that takes the base rate of criminality into account.

Comment · 10 years ago
Your source says he admitted writing the comments, which is much stronger evidence before a court than the original comment could ever be.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton