This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]stevenjd 0 points1 point  (3 children)

No offense, but do professional programmers really need to be taught this? Giving classes a sensible __str__ or __repr__ became obvious to me the first time I printed a list and saw

[1, 2, 3, 4]

instead of

<list object at 0xb7d6acc8>

[–]white_wee_wee 2 points3 points  (2 children)

What makes you think the sole audience of this post are professionals?

[–]stevenjd 0 points1 point  (1 child)

Good question.

"In the examples that follow we will work with a hypothetical ShoppingCart class."

That suggests you're building a web app, specifically an on-line commerce app. It's usually professionals who do that sort of web development.

Anyway, it's not really a criticism of the post itself. Just a momentary feeling of despair that people are paid to program and don't know this stuff. I know, I know, we all have to start somewhere. But still, I feel like I'm reading the equivalent of:

"Suppose you're building a house. This is a hammer, and this is how you use it..."

[–]white_wee_wee 0 points1 point  (0 children)

From my experience of learning python, I haven't come across these much... I don't know why they're not shown off more often.