---
title: "Sloth (@TechSloth) | Hashnode"
description: "Helping others perform better in technical interviews. Read the latest articles by Sloth on Hashnode."
url: "https://hashnode.com/@TechSloth"
---

@TechSloth

# Sloth

@TechSloth · Joined April 2021

Helping others perform better in technical interviews.

## Comments

[I'm going to push back on your push back. There are situations where comments are necessary e.g. commenting on the intent of the code, warning of consequences or clarifying the purpose of the code (I would refer to Bob Martin's Clean Code for examples on these). However when writing production code on your own projects / other projects you should get into the practice of writing code that can be understood without comments. This is for a number of reasons: Comments are just another piece of code that needs to be maintained. I've seen many situations where the code and comments didn't match because the developer changed something and forgot to update the comments. It promotes lazy variable / function naming: instead of writing down what the functionality does in a comment, you should try to think about how to write the code in a way where the comment isn't needed. It adds a lot of noise. When I'm reviewing or working on code, I don't want to be looking at comments. I want to be looking at code. "Trying to figure out a complex bit of uncommented code takes much more time." You have picked up on one of the key elements of clean code - managing complexity. If you're looking at some code, and you don't understand what's going on it usually means that the code isn't written cleanly and the correct abstractions haven't been used. Writing legible code is difficult but it's an incredibly important part of software engineering. I would recommend reading Bob Martins Clean Code and also a philosophy of software design by John Ousterhout.](https://hashnode.com/posts/newbie-developers-and-cringeworthy-moments/6077dba2a3407a32d7042b1a/comment/6078c20fa3407a32d7043fb2#reply-607939d84155da32fc83d67a)

Reply · Article · Apr 16, 2021 · [Newbie developers and cringeworthy moments](https://hashnode.com/posts/newbie-developers-and-cringeworthy-moments/6077dba2a3407a32d7042b1a)

[Ben Hammond Good question! It's a new feature that was introduced in py 3.5 for type hinting: see here for documentation https://docs.python.org/3/library/typing.html Here's a good example of how it works with a type checker called mypy: https://stackoverflow.com/a/38217786/2311710](https://hashnode.com/posts/crushing-tech-interviews-with-the-linked-list-reversal-pattern/6075bf4585f3a21e3926d311/comment/6075ceacab0af52a0fead181#reply-6076c1b14155da32fc83a100)

Reply · Article · Apr 14, 2021 · [Crushing Tech Interviews with the Linked List Reversal Pattern](https://hashnode.com/posts/crushing-tech-interviews-with-the-linked-list-reversal-pattern/6075bf4585f3a21e3926d311)

[Ah, I assume that what you're showing me is the reverse method within a LinkedList class. Like you've already mentioned, my solution will just return the new head; I'm not adding a method to a linked list class. Both solutions are correct and to be fair if this was the real world, the reverse method on the linked list class would definitely be the way to go. However, if the question they're asking is: Given a head node of a linked list, reverse the linked list You would most likely be better off writing a function that has the following signature: reverse\_linked\_list(head: LinkedListNode) -> LinkedListNode: However, if the question is: Create a LinkedList class with a reverse() method which will reverse the pointers of all the nodes in the list then you definitely go for your approach. Thanks for reading!](https://hashnode.com/posts/crushing-tech-interviews-with-the-linked-list-reversal-pattern/6075bf4585f3a21e3926d311/comment/6075ceacab0af52a0fead181#reply-6075d4da9c6b4f29eaec1dbe)

Reply · Article · Apr 13, 2021 · [Crushing Tech Interviews with the Linked List Reversal Pattern](https://hashnode.com/posts/crushing-tech-interviews-with-the-linked-list-reversal-pattern/6075bf4585f3a21e3926d311)
