"...in bearded dragons, a species of lizard native to Australia.... At cooler temperatures, chromosomes prevail, turning on one sequence of genes to make a female dragon; at warmer temperatures, a completely different series of genes can override partial male development and produce a female.... Why would a temperature-dependent pathway to one sex or another evolve? In reptiles... the ability to change sex in response to environmental cues has been retained across diverse species, from sea turtles to crocodiles, indicating both that it arose early in their evolution and that it confers an adaptive benefit.... For reptiles living in [arid] environments, being born closer to the end of the breeding season, when temperatures are beginning to drop, it could be more advantageous to be male. That’s because males can grow to a size where they can mate with females within that timeframe.... Females born late in the season could have to wait until the next breeding season, when temperatures are warmer, to successfully mate and produce offspring...."
From "In a Warming World, Heat Interferes With Sex Determination in These Australian Lizards/Scientists have discovered how hot temperatures override chromosomes in bearded dragons" (Smithsonian).