HNHacker News
TopNewBestAskShowJobs

housecarpenter

178 karma · joined May 15, 2019

meet.hn/city/gb-Liverpool

Socials:

- github.com/Andrew-Foote

Interests:

Art, Books, Gaming, Music, Programming, Remote Work, Science, Web Development, Writing

---

submissionscomments
housecarpenter··on 5% of 666 Python repos had comma typo bugs (inc V8, TensorFlow and PyTorch)
It's not really an operator. It's part of the syntax of string literals. "foo" "bar" is an alternative way of writing the string literal "foobar". If foo is not a string literal, foo "bar" is invalid syntax.
housecarpenter··on Nobody Pronounces the 'B' in 'Debt'
The L in "falcon" in the spelling pronunciation is a "dark" L, which is a pretty different sound from the "light" L, but it's still there. In most accents of English L regularly manifests with the "dark" sound before a consonant or at the end of a word, and with the "light" sound elsewhere.

Both L sounds involve raising the tongue, but with the light L the tip of tongue approaches the alveolar ridge (the part of your gum just behind your top row of teeth), while with the dark L the tip of the tongue does the same thing, but the back of the tongue simultaneously rises towards the soft palate (this is called "velarization", and it's the same gesture that accompanies lip-rounding to form a W sound). There may be further differences depending on accent, e.g. in Cockney accents the tongue-tip gesture of dark L is lost completely so that dark L becomes a fully-fledged vowel, and it might even acquire lip-rounding and merge with W. Other accents have lost the distinction as well and generalized either light L or dark L to all positions (e.g. Scottish English tends to use dark L everywhere).

In the older pronunciation of "falcon", there's no L there at all, light or dark. It was borrowed from Old French "faucon", and the L was restored in spelling via Latin influence in more or less exactly the same way as the B in "debt".

housecarpenter··on Nobody Pronounces the 'B' in 'Debt'
English doesn't tolerate word-final -mb. It's always pronounced as -m, and the -b isn't pronounced when a suffix is added either.

Other examples: dumb, tomb, comb, womb, numb, thumb, catacomb, Coulomb. All of these have a silent B.

housecarpenter··on Nobody Pronounces the 'B' in 'Debt'
French t is dental, English t is alveolar---in non-technical language, that means the French t is pronounced slightly further forward in your mouth, compared to the English t.

The English t is also aspirated a lot of the time (though not as consistently at the end of a word as at the beginning), while the French t is never aspirated.

There could be differences between the two short e sounds as well, but that depends more on which particular accents of English/French you're talking about.

housecarpenter··on Nobody Pronounces the 'B' in 'Debt'
It's happened again and again with other words. "often" (older pronunciation: "offen"), "Anthony" (older pronunciation: "Antony") and "tortoise" (older pronunciation: "tortuss") are examples where the spelling pronunciation still hasn't totally won out. Words where the spelling pronunciation has reached fixation include "falcon" (older pronunciation: "fawken"), "reptile" (older pronunciation: "reptil"), "sphere" (older pronunciation: "spear"), "bankrupt" (older pronunciation: "bankrout"), "baptism" (older pronunciation: "baptime"), and "perfect" (older pronunciation: "parfit").
housecarpenter··on Does anyone else get really bored while they're on vacation?
I don't get bored, because I can regularly come up with some kind of project to work on that'll sustain my interest. However, so far I've never managed to finish one of these projects to an extent that I'm satisfied with before having to go back to work, at which point I end up being too mentally drained to continue work on it and, eventually, forget about it. So ultimately the experience is pretty unsatisfying and I can imagine that after a few more years of the working life (I only graduated a couple of years ago) I won't find it worth repeating it, and then I'll probably be getting bored during time off. My best hope to avoid this is probably to try to make my breaks more long and continuous rather than short and spread out.
housecarpenter··on What’s the Difference Between American English and British English?
I believe "haitch" is normal in the Republic of Ireland, a shibboleth for Catholicism in Northern Ireland, and common in various odd areas where there's a lot of Irish influence. I'm English but some of my grandparents were Irish Catholics, and I come from Merseyside, where a large proportion of the population has a similar family background, and I say "haitch". But for English-in-England, "aitch" is definitely the more common pronunciation.
housecarpenter··on What’s the Difference Between American English and British English?
I think these features are more general young-isms, not really regional. Older Americans don't use them either, right?
housecarpenter··on What’s the Difference Between American English and British English?
The glottal stop is very common in British English varieties, but the extent to which it occurs is pretty variable, and it's still perceived as somewhat sub-standard (depending on where the T it replaces occurs; replacing Ts between vowels is more sub-standard than replacing Ts at the end of a word, which is more sub-standard than replacing Ts before a consonant [in fact even Americans frequently replace Ts at the end of a word]).

On the other hand, in American English, flapping happens pretty reliably in the appropriate environment, and it's absolutely standard and expected---any failure to flap where required will probably lead to your speech being perceived as having a British twang.

There's also a phonemic vs. phonetic thing here. In British English, a T turned into a glottal stop can still be distinguished from any other consonant, so it's still a T phonemically even though the phonetic realization has changed. In American English, flapping applies to both T and D and the result is usually indistinguishable with respect to having been originally a T or a D. In that sense American is going a step further.

housecarpenter··on Python, unlike C, has the mod operator always return a positive number
But then why should the average of zero items be zero? It still seems like just an arbitrary choice to me.
housecarpenter··on Teaching D from Scratch: Is it a viable first language?
You do still hear people speaking of a string of bits, as well as a string of characters. I think the word "array" tends to be preferred for lists of numbers, since in its original sense in mathematics it was (and is) a synonym for "matrix". For lists of arbitrary objects I guess "array" won out by random chance, more or less.
housecarpenter··on Features of a dream programming language
I normally select the whole block that I just pasted and then press Tab or Shift+Tab to indent/dedent the whole thing at once---no possibility of missing the last line then. This works in most editors.
housecarpenter··on Features of a dream programming language
The Haskell concepts are not quite the same as the mathematical concepts; they're somewhat restricted, and different aspects of them are emphasized (e.g. monads---programmers generally think of bind as the basic operation and join as derived, mathematicians generally think of join as the basic operation and bind as derived). So different names could be justified for that reason. It's also not just "math jargon" but "category theory jargon", which is worse than ordinary math jargon.
housecarpenter··on Python, unlike C, has the mod operator always return a positive number
Python's int() truncates towards 0, but (at least in Python 3, I don't know if it was always the same in older versions) its division operator always floors, so -7 // 2 gives -4 even though int(-3.5) is 3. (The int() function is best thought of as just "make this float into an integer, I don't really care how"; if you want to be more specific, you have math.floor(), math.ceil() and math.trunc(), and you also have round(), which rounds towards the closest integer; if the float is evenly between the two integers, it goes towards 0 when the integer part is even and away from 0 when the integer part is odd.)
housecarpenter··on Python, unlike C, has the mod operator always return a positive number
In practice, when you use a modulo operator the second operand is usually some kind of length or size, which is inherently non-negative, while the first operand is an index or offset, which could easily be negative if there's no natural origin point. So it's much rarer that you have to deal with a potentially negative second operand, compared to having to deal with a potentially negative first operand.
housecarpenter··on Python, unlike C, has the mod operator always return a positive number
An example would be if you want to find the month corresponding to a timestamp. The obvious thing to do is to scale the timestamp so that it gives you the number of months after the epoch, take that number % 12, and map 0 to January, 1 to February, etc. (assuming the epoch is in January). But if you try to do that with a timestamp from before the epoch, you'll end up with 0 for January, -11 for February, -10 for March, etc.
housecarpenter··on A Python Guide for the Ages
I used generators with return values once when writing a lexer. I had generators for each of a bunch of different states of the lexer (e.g. skipping over whitespace, reading a numeric literal, reading a string literal, etc.). Each generator would yielded the tokens that it could and then either return one of the other generators (if a state transition was required) or None (if it reached the end of the input and the state was one where this wasn't an error condition). The whole thing was tied together with this function:

  def lex(src):
    state = skip_whitespace

    while state is not None:
      state = yield from state()
It wasn't particularly essential to use the return value from the generator here, as I could have just made the state variable available in the scope of the state functions for them to mutate, but this seemed like a cleaner way to do it as it enforced the idea that each new state corresponded to a new function.
housecarpenter··on A Python Guide for the Ages
It depends on whether you think of the break as success or failure. When I write a loop with a break it's usually some kind of search where the break happens once you've found something, and in that case the break is more of a success.
housecarpenter··on I Can’t See You but I’m Not Blind
I'd slightly trollishly say nobody has aphantasia, it's just that some people make a false distinction between remembering what something looks like and seeing it. Same as what you're saying really, but makes people feel better about themselves, rather than worse.

It seems clear at any rate from the way these discussions always go that aphantasia vs. non-aphantasia, as real as the distinction may be, is hardly predictive of anything else about a person, and the subject only attracts so much interest because people mistakenly assume it's more predictive than it is.

housecarpenter··on SQL: The difference between WHERE and HAVING
In the relational model used by SQL, types are atomic. Sum types are inherently non-atomic. I'm sure you could graft them onto the language, the same way Postgres can have JSON type fields and all that, but I don't think you'd be able to really integrate them into SQL without fundamentally changing what kind of language SQL is.
housecarpenter··on I self-learned to code at 30
Sounds like it to me!
housecarpenter··on Show HN: Array – A Better Python List
Python does have a "partial" function which does currying:

  from functools import partial

  a |> partial(zip, b) |> partial(map, func1) |> partial(filter, func2) |> partial(forall, func3)
Obviously it's a bit more verbose than if the currying was done implicitly, but it's not too bad, I think. You could also import partial under a shorter name if you want.

partial does have an advantage over implicit currying in that you can use keyword arguments to neatly curry on a parameter other than the first, although this isn't properly utilized by Python because most of the built-in functions have place-based rather than keyword arguments. In languages with implicit currying you have to use anonymous function expressions or functions like flip (flip(f, x, y) = f(y, x)) to deal with this.

It might also be worth noting that |> doesn't essentially need to be an operator, it would just be syntactic sugar:

  def chain(x, *fs):
      y = x
      for f in fs:
          y = f(x)
      return y

  chain(a, partial(zip, b), partial(map, func1), partial(filter, func2), partial(forall, func3))
Obviously having it as an infix operator is nicer, and produces less parentheses.
housecarpenter··on Tone-Deafness Test
Cantonese and other East Asian tonal languages are, more specifically, contour tonal languages; the distinctions between the different tones are based on the change in the tone through the syllable (rising vs. falling, etc.), rather than absolute pitch. This may be easy enough for tone-deaf people to deal with. However, there are other tonal languages, e.g. in Africa, which make use of absolute pitch distinctions.
housecarpenter··on Programming with Categories
You should read the famous book by Linderholm, Mathematics Made Difficult
housecarpenter··on Programming with Categories
It may be worth explicitly noting that category theory and set theory are not mutually exclusive. You can use set theory as the foundation, and build category theory on that, and then use category theory to do all that interconnection of fields and whatnot. To me it seems like the most natural way to do it, because set theory is simple and intuitive (kind of), whereas category theory is complicated and extremely abstract.

(Of course there is a lot of stuff in set theory that is counter-intuitive when you get to infinite sets, but I still think that's better than what you have with categories where they're just abstract algebraic objects and there isn't any intuition in the first place.)

housecarpenter··on The Race to Save 'Contact Languages'
I think you could question people's desire to save endangered species in much the same way. Ultimately I think it comes down to the fact that languages (and species) are seen as intrinsically valuable to some extent and the world is just a sadder place without that richness. Language isn't the whole of culture but it's a big part of it, and it seems to me that if culture is worth preservation then so is language. I can't really deny that from an ultra-rational perspective it'd probably be more efficient, in some sense, to have a world monoculture; heck, the world might even be a much more peaceful place---but I still just don't want it.
housecarpenter··on Coding and drawing
If you're drawing something you can see, I don't see why you would need visual imagination.

Even if you're not drawing from something you can see, you can have a procedural memory of how to draw the thing, and you can see what you've already put on the page, and experiment if necessary using an eraser.

I don't have complete aphantasia, but my visual imagination is pretty weak, and I can still draw.

housecarpenter··on The 2,500 year old history of why Python’s all([]) returns True
I may be blinkered by my mathematical training, but to me this seems like the obvious thing to do. Here's an attempt to justify it based on common sense, no math stuff required. Suppose you do something like

  if(all(requirements)) { proceed; }
If there are no requirements that need to be satisfied, then you should be able to proceed.
housecarpenter··on Dictionary union (PEP 584) is merged
The analogue of the OR operator in set theory is the union operator. People think of them as basically the same thing because of the correspondence between a property and the set of things with that property. If A is the property of being either B or C, then the set of the things that are A is the union of the set of things that are B and the set of things that are C.
housecarpenter··on Isomorphic-git v1.0
A little correction: an isomorphism is a homomorphism which is bijective and has a homomorphism as its inverse. For many structures the inverse being a homomorphism automatically happens as a logical consequence of the function being a bijective homomorphism, but this isn't the case for all structures. The most prominent examples are topological spaces: a bijection between topological spaces can be continuous (i.e. a homomorphism of topological spaces) but can have an inverse which is not continuous.

The classic example is a function which maps an interval to a circle by applying cos and sin to get the coordinates; this is continuous as small changes in the interval result in a small change in the position on the circumference, but its inverse is not continuous because there will be a point on the circle where the nearby points on one side come from the start of the interval but the nearby points on the other side come from the end of the interval.

← PreviousPage 4 of 5Next →