4 ms·
I opened 1.8.1 because I thought it'd be the first section with code and the code was not PEP-8 compliant. Having a brief scan, the authors seem to have a pret
by notafraudster 8y ago
I opened 1.8.1 because I thought it'd be the first section with code and the code was not PEP-8 compliant. Having a brief scan, the authors seem to have a pretty severe aversion to putting spaces after commas, which is a bummer because it really impacts code readability. It's inconsistent even from line to line, so it's not a style thing. They're also inconsistent about using single and double quotes for strings.
I skipped ahead to "implementing a stack in python", which is a little weird because the stack class they implement is just a thin wrapper around lists with append aliased to push and "self.items[len(self.items)-1]" aliased to peek (note: in python you can just use negative indexing to access items near the end of a list)
This might seem pedantic, but, like, if the book isn't leveraging Python and it's not particularly clean code then I don't really understand what's on offer here.
- all_factz 8y agoI don't think that's fair. I thought the discussion of AVL trees was quite readable. The code is basic and straightforward, and that's what you want for something like that. It's about the algorithms, not about being pythonic -- it's about fundamentals. For that, this seems good to me (though I'll admit I haven't read a lot of it yet.)
- Rainymood 8y ago"I don't want to read something because I don't like the writing style." I personally can get behind that argument. As an author you have to incentivize the reader to engage with what you've written, that's the job of the writer, not the reader. If you, in this way, alienate some users (like the one you replied to) so be it, this is also a choice of the author. I personally can't read `def fun(a,b): ...`, I strongly prefer `def fun(a, b): ...` and hence I stopped reading as well.
- kkarakk 8y agothe amazon comment section for any technical books are littered with comments like yours(and i have declined to purchase books based on these comments).
- SiempreViernes 8y agoThat you don't like the taste of no space after comma is a fair reason, but it is still a pedantic reason. Personally I think the importance depends on the font face and particular letters used, and in your example it was entirely unimportant: I couldn't actually see the difference for a good while.
- pumanoir 8y agoThis is a great book. I read it and helped me a lot. I recommended it to two other people who had upcoming interviews who did not know about algorithms and they got the jobs. So yes your comment is pedantic. If you read the book you will learn the book isn’t about python at all but about problem solving and data structures.
- xapata 8y agoThere are several low-karma accounts praising the book. Seems like a voting brigade. I agree with the assessment: Poor-quality code. Best to learn from a different source.
- dang 8y agoIt's against the HN guidelines to insinuate astroturfing without evidence. Some other users holding a different view doesn't count as evidence. If you think you're seeing abuse, you're always welcome to email hn@ycombinator.com so we can investigate—which we always do. But please don't post like this in the threads.
- xapata 8y agoThere are different qualities of evidence, but the one I provided evidently didn't make the quality bar you're looking for. I wasn't insinuating but accusing. I'll email that account instead the next time, I wasn't aware of that as an option.
- dang 8y agoAccusing is even worse! The problem is that, while this sort of abuse is real, it's much less common than people imagining that they see it when it's not really there. I've written about this a ton in the hope of explaining why we have the rule we do: https://hn.algolia.com/?sort=byDate&dateRange=all&type=comment&storyText=false&prefix=true&page=0&query=by:dang%20astroturfing https://hn.algolia.com/?sort=byDate&dateRange=all&type=comme...
- xapata 8y agoI suppose it's very difficult to tell the difference between astroturfing and a group of people who feel compelled to voice an appreciation for something, perhaps notified by a "Hey I posted this to Hacker News!" message on a mailing list or a Twitter profile they follow. In this case, yes, I would fall into the category of people (as you described in your comments elsewhere) with a strong opinion and confusion over why someone would think otherwise. Except, of course for the author of the article and friends.
- chapium 8y agoI'd usually not respond, but this is overly negative and missing a number of points. * PEP-8: This code is trying to demonstrate some pretty basic algorithms in simple terms. Should we care about double quotes versus single quotes and spaces to separate commas? If anything, this is an editorial issue in my opinion. Perhaps for your projects and production code you want it to be strictly PEP-8 compliant, but it does not diminish what is being presented here, which are examples of basic algorithms. * Stack class is a thin wrapper: The author was built a stack class using common conventions. Some of it is pretty redundant, such as "def pop(self): return self.items.pop()", but the point remains. This is a clear and simple representation of an algorithms, focused on a common language. The fact that you can do stack-like things to a list misses the point of making a Stack class act and look like a stack. If anything, Python's list syntax makes implementing this minimalist. * "The books provided on interactivepython.org are free and open source. They are for educational purposes." Perhaps the editing could be better. There are many ways to solve the same problem. At the end of the day this is given out for free and is a wealth of information.
- xapata 8y agoPEP-8 is a red herring. Aesthetics, however, is not. The beauty of code is often an excellent indicator of its general quality. You bring up a good point about editing and the value of free/open-source. I've been thinking about this often, recently. It's similar to the troubles plaguing news media. The propaganda may not be as malicious, but is similarly self-promoting, or promoting one's interests. Students have always suffered from bad textbooks, but before the internet we relied on professors to select good ones. Now we just have popularity and the vagaries of Google or upvotes on Hacker News. Of course, professors haven't always been great editors either.