Yes, that's correct. On the other hand, doctests are not only tests, but also a documentation; `sorted(...)` is a bit less readable, and it makes a worse example - users are more likely to use `.most_common` than `sorted` in their own code.