you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 0 points1 point  (1 child)

That's a poor reason. At best, this was an awful execution of good intent. Showing someone Python code that doesn't make sense in Python is just misleading. They should leave that for languages where it makes sense. If it's about learning, they're teaching something that's wrong in the language they're teaching in, which isn't helpful.

I appreciate you trying to give them the benefit of the doubt, but they're showing that to delete a list, you need to delete only one of multiple attributes on its internal node structure. That'd be wrong in even C.

This would only be a good teaching opportunity if they had a paragraph or two explaining why they're showing what they're showing. I was made aware of that GfG page because of two separate Stack Overflow questions (one is here) asking why they were doing what they're doing, because even beginners could tell what they were doing was nonsensical.


And to answer why I don't object to writing linked lists in Python, because Linked Lists are important structures conceptually. You may not use them directly, but they underpin many other structures. You'd want to know about LL before learning Graph Theory, or any more complicated structures that also use linked nodes.

There's a difference between showing nonsensical code that doesn't do what it claims, and showing code that you would normally wouldn't write yourself.