Lots of C bashing going on here.
I’ll only comment that C is used today mainly in the embedded domain, a place where it is strong and growing (in terms of jobs etc).
Certainly, WebAssembly is bringing a lot of good existing C/C++ code to the frontend. In a personal project, I’m using libogg, libopus and libspeexdsp. I find it really cool to be able to use these from the web! (I guess these particular libs lend themselves well, because they have little interaction with the OS, and are very portable.)
And then there’re also the big names in game development porting their engines, of course.
For myself, Python 3 is different enough from Python 2 that it is close enough to learning a new language, and if I’m going to invest that much in a new language, it isn’t going to be Python. It’s just not compelling enough. I use Python for things mostly because I learned it 15 years ago and it is everywhere, not because it’s any good.
Despite the length of the linked article, I disagree. The most commonly used 99% of the language (besides the print function) are identical. For most of my day-to-day usage the code I write runs simultaneously under Python3 and Python2 with no modification.
One particular point of pain I’ve experienced is that many of the collection operations return generators now rather than lists, so the following code is the opposite of what my brain wants to happen:
>>> if filter(lambda _ : False, [1, 2, 3]):
... print("hi")
... else:
... print("bye")
...
hi
I can write Python3 code, but I end up having a bunch of list constructor calls everywhere because I don’t know what returns an actual list and what doesn’t. IMO, Python 2 hit the sweet spot for the language. It was good enough to get stuff done but had a clear ceiling on how complicated of a problem you should solve with it. Python 3 is trying to push that ceiling up but it’s not adding anything that I think actually pushes the ceiling up and it is adding some complication I don’t really have any interest in dealing with.
That’s an interesting point. I think you could try developing a habit of using any or all in such cases, e.g.:
if any(False for i in [1, 2, 3]):
print("hi")
else:
print("bye")
(Assuming that False is a shortcut for a filtering condition that returns False for all items of the list). Would it help in your case?
That doesn’t really capture the same thing, in reality it’s something like:
foo = filter(...)
if foo:
# do something with it
Hmm, I’m not sure. The boolean value of a list is True if the list is non-empty and False if it is. So the boolean value of filter(condition, list) is True iff it returns a non-empty list iff at least one element of list satisfies condition. Or do you have something else in mind?
The code snippet I showed above removes every element from the list but still goes through the True path of the if, this is because filter does not return a list in Python3, unlike Python2, it returns a generator, which is always True.
EDIT:
The output in the repl is:
>>> filter(lambda _ : False, [1, 2, 3])
<filter object at 0x800799278>
This is the correct answer.
As someone who works extensively with Python 2 & 3, the differences aren’t that great. At least nothing a 2 minute Google can’t fix.
At this stage, I see no reason to start a new project in Python 2. Py2 is only used for legacy projects (at work, where upgrading isn’t easy. For my personal projects, I’ve moved to Py3).
Depends on what you use it for. Especially if you’re making GTK based GUIs, python 3 and its gobject is extremely different from python 2 and its pygtk.
I downvoted this specifically because I don’t think inflammatory titles like this should be supported.
It’s tough because the content is excellent but the title is intended to be clickbait-y.
I’m not sure what the answer is; maybe liberal HN-esque renaming of article titles?
I didn’t intend the title to be clickbait-y so much as merely attention-grabbing (hence not 10 Things You Can Do To Hire Better or whatever) but I guess it’s a fuzzy line. I generally am only motivated enough to write a blog post about something when I get annoyed about it, so my titles are often pretty angry :-)
[Comment removed by author]
I think you’re confused about who the author is addressing. They’re talking to some other “you”, but not you, apy. I don’t think it’s worth getting upset about, though actually I agree and find such titles a distraction.
Fortunately there’s an easy solution (for authors). Refer to “we” instead of “you”. Readers can decide to count themselves in the group or not, but it’s not a forced decision.
Surely there are people that can do them well, but they appear to be rare, and everyone can improve to some degree even if they are better than most.
I am not disagreeing with the sentiment that many can do better at tech interviews, I’m disagreeing with the idea that it applies to everyone. People need to realize that the world is not the little corner they experience.
People need to realize that the world is not the little corner they experience.
Indeed! For example, if I write an article and want other people to read it, I’m going to try and submit it to the popular news aggregators with a catchy title. Sometimes being pithy requires sacrificing some accuracy. Sometimes attracting attention means saying something stupid or slightly inflammatory.
Hey, maybe you don’t like mildly inflammatory generalized statements such as “you suck at {…},” but, on the same token, outside your corner of the world, plenty of folks understand that a title may have been chosen to catch someone’s attention and not be the cornerstone of precision.
Yes, and I expressed my opinion by downvoting and explaining by downvote and how I think the community can do better by steering contributors to having less inflammatory titles. Feel free to support such titles.
Note that similar posts successfully make it to websites such as here or reddit with less inflammatory titles quite often, so I don’t think your response is a sufficient justification.
Yes, and I expressed my opinion by downvoting and explaining by downvote and how I think the community can do better by steering contributors to having less inflammatory titles.
… by smugly proclaiming that people should realize that the world is not limited to their corner of experience. I’m just throwing it right back at ya. ;-)
Feel free to support such titles.
Oh I feel free. And I will.
Note that similar posts successfully make it to websites such as here or reddit with less inflammatory titles quite often, so I don’t think your response is a sufficient justification.
Please don’t twist my words. I didn’t come close to implying that one had to write inflammatory titles to get people to read them.
And I wasn’t trying to “justify” anything. I was merely pointing out that you should take your own advice: some people like to get creative with titles. Some people write titles to attract attention—not to be a bastion of precision. (As in, your overly literal interpretation of the title to actually mean the author was talking to people he didn’t know—like you—is ironically indicative that you are living in your own little world.)
It’s not inflammatory at all. It is a bit misleading.
A better title would have been “You suck at taking interviews, and here’s why.”
Except it’s not about interviewers sucking at taking interviews, it’s about the industry sucking at giving them effectively.
I’ve been asked this question too, and I gave one answer (the same as in the blog). The interviewer then proceeded to give me 3 more ways you could solve the same problem, each more esoteric than the previous. It was clear he had Googled the answer before the interview because as the blog says, this isn’t really a problem you’d face in real life.
I didn’t get the job.
I think it depends on what you are doing it for: As a learning project, or something you want to charge money for (ie, something like a MVP)?
For a learning project, you do as much as you can. Because all abstractions leak, you need to know exactly how the system is working across all layers.
If you are building something you want to charge for, or something else you’d like to show to others, to boost your resume for example, then you always use the most stable existing solution.
My preference is for the latter, even for hobby projects. The problem is, as I wrote in my blog recently (http://pyskool.com/one-day-programmers-day-will-never-come/) , people choose projects that will take 20 years to complete, and then get bored after 20 days. They then give up and go to the next cool thing, get bored with that, move on etc , never finishing anything.
So my personal preference is to take the smallest thing, and actually finish it. Outsource everything not core to your product. Don’t spend 7 days getting an SSL cert and integrating Stripe, when you could just add a Payal or Gumroad button in 7 minutes.
But this is me coming from a bootstrapped/MVP angle, and it will be different for you based on your goals. Which is the second thing: You need to know what your goals are. Choose based on that.
Would it be fair to say that Flask is roughly equivalent to Sinatra, only in Python instead of Ruby?
I’ve only done a tiny bit of playing with Sinatra, but I’d say that it’s an apt comparison. From my vague recollection of Sinatra I’d say it’s slightly more micro than flask.
Would it be fair to say that Flask is roughly equivalent to Sinatra, only in Python instead of Ruby?
Yes.
Except that, while in the Ruby world, Rails is the number one (only?) choice, the Python world is more fragmented. I won’t say if this is a good or bad thing. I personally prefer Flask.
I bought the book when it came out. It is more useful for people who already know some Flask, as it teaches best practices (a bit like 2 scoops of Django).
This struck a chord with me. I’ve spent a large portion of my life pretending I’m going to build something amazing. It comes in waves. Get an idea, imagine how awesome I’ll be when I bring that idea to life, feel accomplished over work I’ve yet to do, weeks and a few feeble attempts later realize I’ll never make that awesome thing and start to feel terrible. Then I come up with another idea. Wash, rinse, repeat.
It’s not enough to have great ideas. You need to finish them too.
That’s why I always recommend people start with small things that they can finish in a week or two, a month at most. It is very satisfying to finish things, no matter how small, and gives you the strength to carry on through the hard times.
There’s a bunch of problems with this article.
So in order to argue that Python 3 is bad and development should stop and shift back to Python 2, it is a necessary prerequisite to explain why an all-volunteer army should stop volunteering in the way that they want to volunteer and start volunteering in the way that you want them to volunteer.
This frames the argument in stupid and highly misleading terms. The “Python 3 is bad” argument is a cause-and-effect argument: if the Python developers keep Python 2 deprecated while it’s heavily used, then the community will split, and there’s a presumption that splitting the community is bad. Countering this requires either disproving the implication or asserting that splitting the community isn’t bad, and this section fails to even attempt to address either of these.
Of the top 200 3rd party libraries, 80% have Python 3 support at the time of this writing.
If 99% of the libraries I’m using have Python 3 support, I’m stuck with Python 2. Unless I have enough time and expertise to port the libraries I’m missing (and of course I don’t), it really needs to hit that magical 100% for this talking point to go away.
This is equally absurd. For example in March 2014 Python 3 downloads overtook Python 2 downloads by a healthy margin 54% vs 46%.
I have to ask: who downloads Python from Python? I literally never have, either at home or at work. Everybody I know gets it from alternate distribution channels. I think this statistic is misleading; for instance, Debian’s popularity contest puts the ratio of installs of 2 to 3 at about 4:1.
Regardless, if downloads of the old, deprecated version of your software only trail the new version by 15%, something is terribly terribly wrong with your migration plan.
[Rails] by the way, is not backwards compatible either
Python 3 would be much less of a big deal if Python broke compatibility in major ways with every minor version. (Of course, Python as a whole would likely also be much less of a big deal.) Comparing your problems to those of a terribly-run project and claiming victory is hardly a compelling argument.
And, of course, the entire article misses the actual giant elephant in the room: huge volumes (I would guess a significant majority) of all the Python code anywhere in the world is internal code for companies which will never be ported because there’s no business benefit whatsoever but which nevertheless must be maintained.
I mean, I get it; you really like Python 3 and you think the improvements were well worth making. I do too! (Well, I happen to think they did Unicode 100% wrong. But everything else was an improvement.) But in the process, they’ve broken it into two languages, and because of the incompatibility I have to use Python 2 at work. So now I’m forced to either use a deprecated language at home or use different languages at home and work; and Python 3 is the worst combination of not better enough and not different enough from Python 2, so I’m not likely to pick it.
Very good points. I’ll add: I find this whole “If you don’t like it, fork it” attitude very bad- it reeks of passive aggressiveness and responsibility dodging, and the reason so many people are turned off from open source projects (I know I am). We are adult members of a community- don’t ask us to “fork off” any time we say anything that displeases you!
This is not a tiny Sourceforge hello world project. Python is a major commercial tool. It is a key part of many companies infrastructure, so much so that they stand to lose millions if Python breaks. I don’t know about the rest of the world, but here in the UK, Python has become the default language in many engineering firms, replacing everything from TCL to Bash scripts to (shudder) C code. And this didn’t happen by chance. It took many years of work by Python enthusiasts, one company at a time.
I know most people who visit forums like this (& Reddit and HN) come from a web background. I don’t know how hard it is to just migrate your code for a web app. But out here in the engineering world, it’s next to impossible. Like @whbboyd says, there is zero business sense to do so. And this is the second problem: A group of hobbyists / cool kids gang is running the show. “Don’t like what we’re doing? Don’t play with us then.”
The original blog pointed out that this decision was breaking the community apart. And I’m not sure the tone of this blog helps at all. This is not something that’s going away.
But I think I’ve said enough. I’ll go fork myself now.
I don’t know enough about the ins-and-outs of Python’s development, but I can personally vouch for the frustration of developing in Python 3. Not because the language itself is a problem (in fact, I’ve had very few problems with Python 3 as a language), but because the third party libraries which are so prevalent in Python 2 and nowhere near as available in Python 3.
Perhaps forking Python 2 is the proper solution, but there is always an issue with forking something standardized, as XKCD puts so well.
As a user, my only concern is having something usable for professional work. For now, that language is still Python 2 for me. Anecdotally, I am not alone. Whatever solution is chosen, a solution to this issue must be found.
I share your experience. If I could just magically move to writing Python 3 code, I’d be a happy camper. But the migration is a major bummer if you’re a library author since you really need to support both Python 2 and 3 simultaneously.
A few years ago, this was really difficult, but if you have the ability to drop support for Python <=2.5 and Python 3.{0,1,2}, then your life gets a bit easier. Armin Ronacher describes a somewhat sane strategy for writing code that is compatible with both Python 2 and 3.
I’ve done it, so it’s possible. But boy, was it a pain! It utterly sapped the fun out of the task and has been a source of some bugs. There are so many subtle differences between the languages that there is definitely some cognitive overhead to writing the OP’s “Python X” subset.
Aside from that, as you mentioned, dependencies can be a problem too. Many of the major libraries have been ported (or are almost ported), but it’s still incredibly easy to come across a library that doesn’t support 3 yet.
It’s probably likely that folks here already know this, but something I’ve been doing for the past couple years in every Python script I write is just starting with this line:
from __future__ import absolute_import, division, print_function, unicode_literals
(Explanation.)
It obviously won’t solve every 2->3 problem, but it’s a nice defensive measure that will reduce future burden.
Agree with everything you say.
The big and famous libraries got ported fairly quickly, but you may have one library that someone took from Sourceforge and then left the company, leaving you to maintain the code. And you can’t migrate until you replace that one library. And as far as the boss is concerned, there is no financial sense in moving to 3.0 (and I agree with him somewhat). It’s always, “Yes, it’s a good thing to do. We’ll put it on the backlog, and come back to it when we have time.”
But you never get time, as there is always one more feature, one more bug to fix.
This, I think, is the biggest reason. There’s enormous boatloads of commercial Python in the world (I’d speculate that it could easily be the majority of Python code written) which is all in Python 2 and which will never get ported (because that’s expensive and yields no business benefit whatsoever) but which still must be supported.
I agree with this in general, though don’t know about the Wordpress comment. Installing Wordpress takes two minutes, and is faster than hand crafting HTML. Not to mention, it’s so easy to extend and add functionality. I would always choose Wordpress as a first choice, unless I had a good reason not to.
Man, this article seems unnecessarily negative:
Now, I’ll admit it to anyone that I hate PHP with the passion of a thousand burning suns.
… every PHP code base I’ve seen is an absolute wreck, and I pity the soul of the one who has to maintain it. How could any real engineer use PHP?
Designers weren’t afraid to use it. For the first time ever, PHP let dumb people (you know, people who understand people) …
… until now the embedded device landscape has been ruled by bit-banging neckbeard overlords …
Now the author might be trying to use literary freedom to entertain the reader as embedded software development isn’t always the most captivating topic. And, it’s true, that for the Internet of Things to really succeed, it will need an almost frictionless entry point – something PHP is excellent at. But does the author need to do so with such negativity?
(meta: I want to downvote this article because there I feel it’s negativity out weighs any benefit, but that isn’t one of the listed reasons. On purpose? I’d guess so, as the truly awful stuff (outright racism/sexism/etc) would probably be immediately moderated.)
Agreed. Don’t know what the PHP bashing was all about.
I have worked in embedded systems for about 10 years now, and if someone asked me how to enter the field, I’d ask them to buy a Raspberri Pi and start playing with it. Or buy a Arduino. I have no idea what this Alljoyn thing does.
After reading the article, my only comment is : What?
I have no idea what the Alljoyn thingy is, and how it relates to PHP.
From the AllJoyn website:
“The AllJoyn framework is an open source software system that provides an environment for distributed applications running across different device classes with an emphasis on mobility, security, and dynamic configuration. The AllJoyn system handles the hard problems inherent in heterogeneous distributed systems and addresses the unique issues that arise when mobility enters the equation.”
So what does it do again?
And then I found this gem:
“The types of applications that will use the AllJoyn framework are limited only by the imagination of developers. ”
I know what we’re dealing with now. What Joel Spolsky called Architecture Astronauts.
i agree that if you use an ORM you trade in problems for others.
the article generalizes the different orm patterns that exist. not all orm are created equal.
since all data can be “relational in nature” his solution to “Encapsulate your relational queries into a Model layer” will in the end just produce your own ORM or lots of duplicated and hard to maintain code.
we currently use the Ruby Sequel Library. I like it because it provides different levels. You can easily drop to customised SQL and speed up things if necessary.
Along these lines, another benefit of the ORM is composability. I find that when working directly with SQL it is much harder to compose queries from smaller, singly focused components. That being said, there are abstractions that operate at a lower level than an active-record-style ORM and map much more closely to SQL (such as Ruby’s Sequel mentioned above or Clojure’s Korma) offering much of the composability benefits that you’d get from an ORM.
No one has mentioned another big benefit of ORMs: security.
ORMs are supposed to sanitise all input, and prevent sql injection attacks. In theory, programmers could do this themselves. In practice, the dozens of hacks at big name firms (can’t remember any examples now) show that most programmers, even at reputable firms, weren’t doing basic sanitization of input.
It might sound a bit cheesy, but let me quote the Matrix to you:
“Neo, there is a difference between knowing the path, and walking the path.” :)
Yes. But I didn’t take anything so deep as that from this particular article. It had no particularly powerful writing to reinforce the importance of actually following this advice. Even some Matrix-style pseudo-mystical stuff would have made it less bland. :)
But it’s still profoundly true, you see… haha. :)
Most of the static site generators don’t seem to generate “sites”. They instead generate “blogs”, with the concept of posts and pages very deep-rooted in the implementation.
I mention because I recently came across statik which is a static site generator written in Python which really lets you generate sites. You get to define the “models” which you’d like your site to have (if you define
PostandPagemodels, you have something like pelican). Imagine Django, but compile-time (for the lack of a better analogy).I might write a blog (heh) post on this later, but I would definitely suggest checking it out if you’re interested in static sites.
I maintain 3 websites, two with Jekyll (https://monix.io and https://typelevel.org/cats-effect/) and one with Middleman (https://alexn.org).
Both Jekyll and Middleman are perfectly capable for static websites. The blogging part is just a nice built-in feature.
I’ve been using Nikola (edit: for my landing page), because at the time it was the only one that had incremental builds. You have to follow their guide to reconfigure it for a non-blog setup: https://getnikola.com/creating-a-site-not-a-blog-with-nikola.html
VuePress has my interest now, especially once Netlify support is implemented.
Edit: I also have Sphinx instances: one as a public wiki and the other as a private notes repo.
The handful or so that I have worked with all support defining models, Sculpin and Tapestry (i’m the author) call them content types, Jigsaw calls them collections. All three can be used to generate a static site, but for convenience (and likely because the usual users are minimalist bloggers) they come “blog aware” which simply means they have a blog collection configured out of the box.
I have used all three and a few others such as metalsmith (which also supports collections via plugin) for the purpose of generating small static sites with a handful of pages for clients as well as reasonable sized multi author blogs.
TL;DR, yes some SSGs come shipped with blog content types (models) pre-configured but that doesn’t make them only good for generating blogs.
This is interesting. I wish it didn’t use YAML though.
For the website, I ended up making a custom generator, and focus on blogs in most generators was one of the biggest reasons, even though not the only one.
Bravo for saying this. I’ve faced the same problem, with static generators forcing me to give an author / date setting for each page. This might make sense for blogs, but doesn’t for the simple site I want to build.
And most of them force you to do things a certain way; it is so painful, which is no wonder people just go back to Wordpress.
Amy Hoy wrote a great article on this : https://stackingthebricks.com/how-blogs-broke-the-web/