27 karma · joined Jul 21, 2015 (11y ago) · 15 submissions
1.
Invalid Strings in Valid JSON(svix.com ↗)
1 points · by jplatte · 1y ago · discuss
comment 9y ago · link · parent
The following program throws a TabError in Python 3:
def demo():
print("1 tab")
print("8 spaces")
It does work in Python 2, but I'm pretty sure the majority of developers have 4 space wide tabs by now, meaning they won't be able to mix tabs and spaces in Python 2 code either.EDIT: So Hacker News has code blocks, but doesn't strip the indentation that is required to introduce them. So you'll have to lead the 2 leading spaces in each line if you want to try this out for yourself.
comment 9y ago · link · parent
E.g. is there something like 'cargo run' that just checks that the required python version is installed (I got the impression that this can be specified somewhere), installs deps if they're not installed yet and then runs the main module? Or something like 'npm install --save' that adds the latest version of a package you already know the name of as a dependency and installs it?
comment 9y ago · link · parent
comment 9y ago · link · parent
It has inspired me to build my own dungeon crawler, and I have reused a lot of his ideas from the article.
comment 9y ago · link · parent
For those who are interested in why leaking memory isn't disallowed by Rusts safety guarantees, have a look at the documentation of the (AFAIK) only safe function in the standard library that leaks memory: https://doc.rust-lang.org/std/mem/fn.forget.html
comment 9y ago · link · parent
Including !g in your search query simply redirects you to a google search with the same query (minus the !g). So you can set your search engine to ddg, then select the actual search engine by starting with a bang and whatever search you want. Some examples:
!gi - Google images
!gh - GitHub search
!w - Wikipedia
Starting a query with ! on https://duckduckgo.com/ also gives you autocompletion, so you can quickly discover what redirects are available.
comment 9y ago · link · parent
I'm not convinced that is actually a good thing. It really annoys me when two libraries for the same language use different naming conventions, and so far I haven't had any trouble with the strict casing rules in Haskell, or the casing conventions in Rust where the compiler emits warnings when you don't follow them (that you can disable with an annotation if you really need to).
comment 9y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent