HNHacker News
TopNewBestAskShowJobs

ddfisher

145 karma · joined January 21, 2010

david.davidfisher@gmail.com
submissionscomments
ddfisher··on Static types in Python
Don't forget Cython [1]! My understanding is that it's quite useable (though it unfortunately uses a different static type system/syntax than mypy).

[1] http://cython.org/

ddfisher··on Static types in Python
This is exactly what mypy allows, actually! (Except for speedups -- types currently have no effect on runtime behavior, and it turns out they wouldn't make a big difference anyway.) The hybrid type system concept is called "gradual typing", and it's actually powered by some somewhat-recent developments in programming language theory. See this seminal paper by Jeremy Siek in 2006 if you're interested in the details: http://scheme2006.cs.uchicago.edu/13-siek.pdf

[Source: I'm a mypy core developer.]

ddfisher··on Static types in Python
Good question! There are separate capitalized types for List, Dict, etc provided as part of the `typing` module in order to let you specify element types. Types are all normal Python expressions, so if you wrote `list[int]` you'd get a runtime error, because `type` objects (i.e. the `list` class) aren't subscriptable.
ddfisher··on Static types in Python
It should work with the Python 3 syntax if you quote your type annotation. I.e.

  def f() -> "Bar": ...
instead of

  def f() -> Bar: ...
(This is normally used for forward references.) This makes it slightly less nice, but not a terrible workaround overall.
ddfisher··on Static types in Python
Yeah, you need to write `from typing import List` to get the generic List class that you can parameterize with an item type. As you pointed out, you can use the builtin lowercase-l list without importing anything, but that doesn't allow you to specify the item type.
ddfisher··on Mypy 0.3 Released – optional static type checker for Python
This is intended behavior, actually! By default, mypy doesn't type check the interior of functions that don't have any type annotations. This lets you slowly introduce types to a large codebase without having to convert everything at once (or even file by file). Adding a type annotation to "bar" will cause mypy to check it:

  def foo(n: int):
      pass
  def bar() -> None:
      foo("123")

  >> main: note: In function "bar":
  >> main:4: error: Argument 1 to "foo" has incompatible type "str"; expected "int"
ddfisher··on PeerCDN: WebRTC-based peer-to-peer CDN [video]
Leeching shouldn't be too much of a problem: the user will upload while they remain on the page (which should be much longer than it took them to download the assets).
ddfisher··on Good people behaving badly on the Internet
Re-reading, I can see that now. Oops! (I think the paragraph break confused me.)
ddfisher··on Good people behaving badly on the Internet
While I agree that being skeptical about self-help books is a good thing, I think you made a big mistake in your specific example. I have not looked at "The Feeling Good Handbook" that you linked to, but I am quite familiar its predecessor (by the same author), "Feeling Good", which is excellent. It has helped a couple of my friends, and at least one other HN reader.[1] Further, its efficacy is supported by at least one clinical study.[2]

You're right about the image, but the book is worthwhile.

[1] http://news.ycombinator.com/item?id=4509281

[2] http://www.ncbi.nlm.nih.gov/pubmed/2738212 (The book is not cited in the abstract, unfortunately, but I believe this is the correct study.)

ddfisher··on RIP Vile Rat, EVE Online Diplomat, IRL State Dept Rep Killed In Benghazi
I think "the root of all evil" is, in general, not a good choice of phrase. I understand the vehemence with with you speak, but I think it's a bit overly hyperbolic and creates quibbling over the word "all". Saying that religion is the cause of much evil (which far outweighs the good) would be sufficient.
ddfisher··on What Is Seen and What Is Unseen: The Hidden Price of Immoral Acts
> Anyone who can complete Tour de France at all or moderately but steadily grow an investment portfolio over the years should be extremely satisfied with just that already.

(I'm not certain what "should" means in that sentence - a moral judgement? - but I'll interpret it as advice.) I think that this is excellent advice for some people, but poor advice for others. I don't think there is anything wrong, per se, with wanting to be the very best at something. There's just a trade-off: you can be happily excellent, or you can take a chance and be perhaps the best but most likely just unhappy. But this decision is, in my opinion, a personal one: happiness does not have to be the ultimate goal of life.

ddfisher··on RIP Vile Rat, EVE Online Diplomat, IRL State Dept Rep Killed In Benghazi
Terrible. RIP. :(

What can we do to stop things like this from happening again? There's clearly no quick-fix overnight solution, but there should be some set of actions we can take to slowly reduce/eventually eliminate this kind of violence. Any ideas?

ddfisher··on We consistently underestimate kids.
Do it! What's stopping you?
ddfisher··on Mars Curiosity's first images
I believe this is the shadow of the rover.
ddfisher··on And everyone gets a robot pony
As another person who's spent some time thinking about this: I disagree. Why couldn't a machine simulate the noise as well?
ddfisher··on Diablo III real-money action house finally goes live
I recommend Escape, actually - it skips the whole conversation. :)
ddfisher··on JIRA and text patches are anti-open-source
I recently started using Phabricator (http://phabricator.org/), which is open-source, and find that it's quite easy to use/set up. It's also used and well regarded by a number of startups, including Facebook, Asana and Quora.

Disclaimer: I've made minor contributions to Phabricator and will be making larger ones shortly.

ddfisher··on Spark
Because Haskell is evaluated lazily, two maps doesn't imply two iterations over the data. In this case, I would expect only one pass through the data for both of the maps. Out of curiosity, I did a quick criterion benchmark for both functions. Here's the result on a list of 100 elements:

  benchmarking spark_mggcl
  mean: 49.29483 us, lb 48.77776 us, ub 50.25594 us, ci 0.950
  std dev: 3.495423 us, lb 2.140951 us, ub 6.373469 us, ci 0.950

  benchmarking spark_ocharles
  mean: 60.12347 us, lb 58.95586 us, ub 61.48084 us, ci 0.950
  std dev: 6.434853 us, lb 5.529613 us, ub 7.824865 us, ci 0.950 
The simpler version appears to be faster.

(As an aside, is there something in particular you dislike about do syntax? I find that it often makes things more readable, though slightly more verbose.)

ddfisher··on Denmark introduces fat-related food tax
As someone considering paleo, I'd be interested to hear what studies you thought well supported the claim that saturated fats aren't the problem and why you thought those studies were more reliable than the ones that indicte the contrary.
ddfisher··on Heretical Confessions of an Emacs Addict – Joy of the Vim Text Editor « /usr
Activate visual mode first. In visual mode, the argument is used for the number of indents (because the lines to indent are selected visually). So to indent the current line 4 times, type: "V4>". Happy vimming! :)
ddfisher··on Nintendo's WiiU: Touchscreen, coming 2012
While I too find it odd that your original comment was downmodded (has it been edited?), I don't think that a personal attack is an appropriate response. It doesn't seem like younata was being a jerk (from my reading of the comments), but your response is a bit vitriolic even if he was.

From your comment history, I speculate that you - like me - are a long-time reader and only an occasional poster. These posts stand out as being unusually negative. I'd urge you to strongly consider changing your tone (and perhaps deleting your posts in this thread). Don't let this one altercation drive you away from the community.

Best -- David

ddfisher··on Nintendo's WiiU: Touchscreen, coming 2012
Perhaps I had the wrong impression, but I thought the correct response to a factually incorrect post was to point out the correct information in a reply, not to downmod the post. This is more inclusive (as everyone is misinformed at times) and is more useful to the community (because it provides them with the correct information).
ddfisher··on Kids who spot bullshit, and the adults who get upset about it
"the general progress of AI"

Out of curiosity, what are you referring to here?

ddfisher··on A Simple JPG Buys The Beer
FYI: you're probably not being downvoted because people think you are incorrect. (In fact, it is my understanding that incorrect information should generally be politely corrected, rather than downvoted.) Instead, the downvotes most likely result from the fact that a post saying only "dupe" adds nothing to the conversation. Noting duplicate articles can be useful when there were interesting comments on the previous version, but should then be accompanied by a link to that post and/or a summary of the interesting comments.

Edit: Sorry if this comes off as overly didactic: I incorrectly assumed you were new. However, my main point still stands.

ddfisher··on Google to Launch Major New Social Network Called Circles, Possibly Today
If Google is going to be launching a social network called "Circles" in the near future, I think they would launch it tomorrow, because tomorrow is Pi Day. (This is meant in all seriousness, Google seems to enjoy small flourishes like that in general, and it would fit with their company culture.)
ddfisher··on Notes on Haskell: What's Wrong with the For Loop
"E.g. args.length returns 0, and they try to access the first element in the list (due to heritage from c pointers we start counting at 0) which is the 'zeroth' one, which doesn't exist"

I'm not sure if you're making some subtle point here that I'm missing, but it is not the case that any of the elements of array will be accessed by that code if args.length is 0. If args.length is 0, then the exit condition (which is evaluated before entering the loop body for the first time) will be false, and the loop body will not be executed at all.

ddfisher··on Hiding Nobel prizes in plain sight
The most recent edit to the article prepended "Nazi" to "Germany" and contributed nothing further. This seems rather unnecessary, as the sentence clearly specifies that this occurred during WWII. Did you make this change?
ddfisher··on Ask HN: How do Hackers kill time when bored on weekend?
Username: "kimidorisakana"

I haven't posted much, but I read HN regularly.