I would have liked to read this, but I didn’t want to make an account. Is this for monetization so that the author can get money? I’m ok with that but do sites really need me to create an account for that? Can’t they just track views?
Whenever I see a page on medium, I just automatically go to archive.is and look for a cached copy.
Here’s this one.
If there’s no cached copy there, I request one and it takes about two minutes.
Sadly that’s Medium… no idea why people use it, you can always read it with Incognito Mode in your browser.
I’ve just started adding medium.com to my ad blocklist. I do wish there was a way to filter specific sites on lobste.rs like you can filter tags.
: I realize it wouldn’t work for this url in particular, because the linked site uses several redirects (with cookies) under the hood, as well as cloudflare – e.g. medium “custom domain”. Still would filter out quite a few though.
There’s a Greasemonkey script for blocking domains and stories.
That looks pretty sweet. Thanks! <3
I take contention with the author’s recommendation of “Handling if-else logic”.
The synopsis: for functions with a significant amount of branching logic it should be abstracted to a dict containing functions. I believe the reason the author recommends this is two fold:
I agree that Python’s lack of a switch statement is less than ideal but I ardently disagree that this “trick” is something to recommend others use.
The dict approach is something that should only take place if there is more than ~10 options IMO. Sometimes it truly is the option to take, as it allows easy extensibility and can separate the code into more logical parts. But reaching 10 cases is sometimes a pointer that something else is wrong in the system, since most of the time there shouldn’t be so much different cases handled by a single piece of code. But sometime, it just has to be like that (in a parser for example) and that’s where you can use dictionaries to clean it up if you need to. Upcoming structural matching should make that choice obsolete though.
Agreed on all counts.
Related to the use of sets: as of 3.7 all dicts in python preserve insertion order. So if you need an ordered set you can often use a dict to get a quick and dirty one really cheaply.