Skip to Content
Navigation:

A stick figure smiling

Here's a preview from my zine, The Pocket Guide to Debugging! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

Image of a comic. To read the full HTML alt text, click "read the transcript".

browse more comics! get the zine!
read the transcript!

Sometimes you print out an object, and it just prints the class name and reference ID, like this:

MyObject<#18238120323>

Illustration of a frowning stick figure with curly hair.

person (thinking): “ugh, thanks, very helpful… “

Implementing a custom string representation for a class you’re often printing out can save a LOT of time. The name of the method you need to implement is: - Python: .__str__ - Ruby: .to_s - JavaScript: .toString - Java: .toString - Go: String()

Also, pretty-printing libraries (like pprint in Python or awesome_print in Ruby) are great for printing out arrays/hashmaps.

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2024 | All rights reserved (see the FAQ for notes about licensing)