HNHacker News
TopNewBestAskShowJobs

n1ghtm4n

48 karma · joined January 5, 2013

submissionscomments
n1ghtm4n··on How to Tango with Django: A Python Django Tutorial
Thank you for putting so much work into this, but it's not Python 3!
n1ghtm4n··on Have young people in Japan stopped having sex?
That's not necessarily a bad thing! People move to cities to find a better life, and they usually find it. That's great unless you think a life of rural poverty is some kind of noble virtue.

The global population is 7.1 billion and rising fast. We should all cheer when we hear these statistics.

https://en.wikipedia.org/wiki/Urbanization#Environmental_eff...

n1ghtm4n··on Have young people in Japan stopped having sex?
Why has no one brought up overcrowding in Japan? You don't think that's going to affect the birth rate?

http://inventorspot.com/articles/six_startling_scenes_overcr...

n1ghtm4n··on On being the right size (1928)
"[God has] an inordinate fondness for beetles" -- favorite J.B.S. Haldane quote. About 1/4 of all known animal species are beetles.
n1ghtm4n··on Against Cynicism: A philosopher's brilliant reasons for living
1) obscurantist jargon. check.

2) banal observations once you finally figure out WTF they are talking about. check.

3) lauded for being the smartest, greatest, most brilliant intellectual of their age. check.

4) books with inscrutable titles like Bubbles: Spheres Volume I: Microspherology and Rage and Time. check. (LOL! How big do your balls have to be to give a book a title like that?)

5) constant name-dropping of fashionable intellectuals. check.

Must be European philosophy!

UPDATE: quote from Amazon description of Bubbles. Behold the enormity of Peter Sloterdijk's balls:

    "reinterprets the history of Western metaphysics as an
    inherently spatial and immunological project, from the 
    discovery of self (bubble) to the exploration of world 
    (globe) to the poetics of plurality (foam)."
http://www.amazon.com/Bubbles-Spheres-Microspherology-Semiot...
n1ghtm4n··on Programming Community Index for July 2013: PHP is regaining ground
The RedMonk programming language rankings seem much more plausible to me. They're based on 1) questions on StackOverflow and 2) projects on GitHub.

http://redmonk.com/sogrady/2013/02/28/language-rankings-1-13...

n1ghtm4n··on What Python developers need to know before migrating to Go
Function overloading can be accomplished by name mangling at compile time.

  PROGRAMMER SEES        INTERNAL REPRESENTATION
  foo(int a, char b)     foo_int_char
  foo(int x)             foo_int
n1ghtm4n··on What Python developers need to know before migrating to Go
>Ok, so it's not just a language wart, but a fertile source of pointless inefficiency in everyday Python code, glad to know.

The fact that it's used all the time would suggest it's not pointless inefficiency, no? Maybe you should try Python before bashing it.

>Python is doing the exact same thing as Go here, but in a less efficient manner.

It's not doing the same thing. "�є" is not the same as "єℓℓ".

n1ghtm4n··on What Python developers need to know before migrating to Go
Thank you for the explanation! Converting to a rune slice and back does give me the behavior that I wanted. It still looks butt ugly to me, but at least it works.

In Go:

    fmt.Printf("%s", string([]rune("нєℓℓσ")[1:4]))
    // єℓℓ
In Python:

    print("нєℓℓσ"[1:4])
    # єℓℓ
n1ghtm4n··on What Python developers need to know before migrating to Go
You're right. You're not very familiar with Python. String slicing with numbered indices is used all the time. And you can slice more than just strings! It's one of the coolest features of Python and you're really missing out if your favorite language doesn't have that.

This might explain why my comments seem like heresy to you. I would point out that the OP is about Python programmers switching to Go.

n1ghtm4n··on What Python developers need to know before migrating to Go
Thank you for expressing it so eloquently.
n1ghtm4n··on What Python developers need to know before migrating to Go
> What happens when you take a slice of a string?

What happens when you slice a unicode string in Go is that it cuts multi-byte characters right in half, unless you get the byte boundaries just right. I know real programmers keep the byte boundaries for all the chars in all their strings in their head at all times, but for people like me this basically makes string slicing unusable for non-ASCII text.

Python somehow magically slices unicode strings without chopping characters in half.

In Python:

    s = "нєℓℓσ"
    s[1:4]  # "єℓℓ"
In Go:

    s[1:4] // "�є"
n1ghtm4n··on What Python developers need to know before migrating to Go
A very good point. I still think it's a big win if it makes it 1% easier for new programmers to understand.
n1ghtm4n··on What Python developers need to know before migrating to Go
Why not a 2-word struct with the rune count instead of the byte count? There's zero performance cost for many strings because the rune count is known at compile time. For the rest, most strings are too short for Big-O analysis to be relevant and I would guess (enlighten me if I'm wrong) that the cost of computing the bounds of each character is negligible on a modern processor. Multi-byte chars in a string are going to be adjacent in memory, adjacent in cache, and therefore trivial for today's not-at-all-instruction-bound CPUs. Again, correct me if I'm wrong.
n1ghtm4n··on What Python developers need to know before migrating to Go
That's 10 minutes where I could be... you know, living my life, man. Everybody knows what + does. You don't have to teach a high schooler that "if A or B" means "if either A or B is true". They just get it. But what the heck does "if A || B {}" mean?
n1ghtm4n··on What Python developers need to know before migrating to Go
Some thoughts after spending ~100 hours with Go.

- Function overloading is a major convenience that you will miss. There are differently named versions of every function and you will call the wrong version with the wrong arguments all the time. The number of functions in the standard library could be reduced by at least 1/4 if they'd got this right. The official FAQ (http://golang.org/doc/faq#overloading) explains that leaving out overloading is "simpler", meaning simpler for them.

- Default parameters are a major convenience that you will miss. Using strings.Replace() to remove some chars from a string? Don't forget to pass the -1 at the end, asshole! The -1 says don't put a limit on the number of replacements. In Python there would be a max=None default parameter and this would never bite anyone.

- No named arguments, because fuck readability.

- Forcing me to handle errors is great. Having 20 different ways to do it is not great. Examples: fmt.Errorf(), fmt.Fprintf(os.Stderr), errors.New(), log.Fatal(), log.Fatalf(), log.Fatalln(), panic/recover...

- Using && and || for logical operators in this day and age is just ridiculous. Why do people keep inventing programming languages as if Python doesn't exist?

- Don't think that just because the Unicode guys invented Go that Unicode is going to be easy. Their solution is not to create an airtight abstraction layer between chars (or "runes" WTF?) and integers. Their solution is to provide almost no abstraction and force you to deal with the inherent integer-ness of all characters. Example:

In Python:

    len("нєℓℓσ")  # 5, because there are 5 chars
In Go:

    len("нєℓℓσ") // 12, because there are 12 bytes
    utf8.RuneCountInString("нєℓℓσ") // 5, plz kill me i am an abomination
tl;dr If you're inventing a programming language for human beings (not UNIX gods), try it out on a group of smart high school students first. It will be a humbling experience.
n1ghtm4n··on A Virtual Weimar: Hyperinflation in a Video Game World
Austrian School economists don't make predictions, but when they do they're right 100% of the time, except when they're wrong in which case I will remind you that Austrian School economists don't make predictions.

If you think I'm exaggerating, check out this unintentionally hilarious excerpt from the Ludwig von Mises Institute wiki. See if you can count how many times they flip-flop on whether they make predictions.

  Austrian predictions

  This page attempts to list various predictions made by
  Austrian economists about important economic and other
  developments.
  Important note: Austrian economists, as Austrian
  economists, or praxeologists, do not predict. They can
  predict not as formal economists, or praxeologists, but,
  rather, in their role as thymologists, or economic
  historians. In praxeology, A causes B, other things
  remaining the same. But, in the real world, other things
  cannot be relied upon to always remain constant. Therefore,
  predictions of the "A will necessarily lead to B" type are
  strictly prohibited. Instead, praxeologists, but not
  thymologists, must limit themselves to statements of the
  if-A then-B variety.
  With this in mind, it is interesting that Austrian
  economists have been quite successful at predicting major
  events.[1]
http://wiki.mises.org/wiki/Austrian_predictions
n1ghtm4n··on A Virtual Weimar: Hyperinflation in a Video Game World
Good to see the Austrian School weirdos at the Ludwig von Mises Institute have given up real-world economics and now just play video games. Hopefully in the virtual world their incredible track record of dead-wrong predictions will cause less harm.
n1ghtm4n··on No Population Bomb
"All this means that on the scale of hundreds of years our population growth may actually look like a very steep sigmoidal curve. But of course, in 2050 our planet and species will look very different than it currently is. There is a limit to what our models can predict about the future population. It could be that the human population plateaus and stabilizes. However, in a world with more energy, more geopolitical stability, advanced A.I., and a larger extraterrestrial presence, our species demographics may begin to change in unexpected ways. For now, we may simply be relieved that Malthus and Ehrlich were wrong. We will not encounter a population bomb."

So we can't predict the future, but the other guys' 50-year predictions "were wrong" [sic] and my 50-year predictions are right. Did I get that right?

His argument can be summarized as "Everything will probably work itself out. Trust me, brah. I'm a futurist."

n1ghtm4n··on America's Baby Bust
OMG! America is under attack by birth control pills! Yes, women in the US freely choosing to use birth control is just like forced abortions and house raids in China.

"The root cause of most of our problems is our declining fertility rate."

Global warming, terrorism, droughts, hurricanes... all caused by birth control pills.

"The replacement rate is 2.1. If the average woman has more children than that, population grows. Fewer, and it contracts. Today, America's total fertility rate is 1.93... it hasn't been above the replacement rate in a sustained way since the early 1970s."

Let's just ignore the immigration from countries with replacement rates far above 2.1 that has increased the US population by 100 million since the early 70s.

"First, global population growth is slowing to a halt and will begin to shrink within 60 years."

Overpopulation isn't a problem because the spread of birth control and women's rights will solve the problem in 60 years. So let's block birth control and women's rights.

"...growing populations lead to increased innovation and conservation."

Horrible droughts lead to increased innovation and conservation of water. Yay horrible droughts!