This article is from the California Driving (and Surviving) FAQ, by "George J Wu" firstname.lastname@example.org with numerous contributions by others.
If you get hauled in for a traffic violation, yes. A licensee must display
it to a magistrate or judge upon request if brought before them for any
traffic violation [CVC 12952]. A charge of failure to have your license in
possession while driving is automatically dismissed if you produce it in
court [CVC 12951(a)], as long as it was valid, etc. After two such
dismissals, the court has the option not to dismiss. So, you shouldn't
make a habit of not carrying it while driving.