Pretty nifty. One of the things traceroute also does is to deal with broken routers that don't send the proper replies, as well as a number of other edge cases, but this is a cool toy and will probably work in most average cases.
I've just started using scapy recently. The syntax is a little inconsistent, but it's really powerful. It defines a domain-specific language (DSL) that piggybacks on python syntax. You can make a traceroute-like object in one line:
This single pkt object describes 22 IP packets, each with a TTL from 4 to 24 inclusive. Each IP packet encapsulates a TCP packet with the SYN flag set.
see also:
http://cluepon.net/ras/traceroute.pdf and http://blog.cachefly.com/2012/02/15/understanding-traceroute...