If flexibility, the ability to adapt quickly to changing circumstances, is one of the most important virtues in our new, high-tech world, boy, are California politicians virtuous.

Take Wendy Greuel. It was less than a year ago that she was running for her dream job as mayor of Los Angeles. Everything in her political career had pointed toward it: her years as an aide to former-Mayor Tom Bradley, seven years on the City Council, a term as city controller.

But on May 21, Greuel lost to the race to Eric Garcetti, ending her shot at the job she had both long coveted and had all the credentials to do.

No matter. When Rep. Henry Waxman announced in January that he was retiring from Congress after 40 years in office, Greuel jumped into the race to replace him within hours.

Never mind that the job of running America’s second largest city couldn’t be more different from serving in Congress or that the skill set needed to run a city of 3.8 million is very different from that required for a first-term member of the House.

“It was a quick decision, but I knew it was right,” Greuel told reporters in January. “I felt it in my gut. This is an opportunity to serve this community.”

What she didn’t say is that the race also is a chance to stay in the political game, which for any long-time pol is every bit as important as community service.

Then there’s Gloria Negrete McLeod of Chino, who announced in February that she was giving up her career in Congress to run for a seat on the San Bernardino County Board of Supervisors.

Of course it was only a two-year congressional career, but it was a great two years.

In 2012, facing the prospect of being termed out of her state Senate seat in 2014, Negrete McLeod decided to run in a newly drawn congressional district and steamrolled incumbent Rep. Joe Baca in a nasty Democratic primary.

Now people might question why a then-70-year-old woman born and raised in California would want to move to Washington, D.C., and become a first-term congresswoman in an institution where seniority still matters. But for a politician, that’s a ridiculous question. It’s an elected office and there aren’t that many of them.

Besides, it turns out the job in Congress was just a short-time gig until something better – and closer to home – turned up.

Leaving Congress wasn’t an easy decision, Negrete McLeod said in a statement, but “my desire to represent this community locally, where I have lived for more than 40 years, and where I have long served as an elected official, won out.”

Finally, we have Hayward’s Ellen Corbett, a state senator who has already spent the maximum 14 years in the Legislature. Faced with the prospect of being out of political office for the first time since her days on the San Leandro City Council, Corbett’s running against fellow Democrat Eric Swalwell for the East Bay congressional seat he won in 2012 by taking out 20-term Rep. Pete Stark,

Never mind that it’s tough to find many political differences between Corbett and Swalwell, a 33-year-old former Dublin councilman, or that Swalwell already has received endorsements from both President Obama and the California Democratic Party.

Instead, Corbett’s campaign website argues that she’s a woman (and Swalwell isn’t), that she went to local colleges (and Swalwell didn’t) and that she has decades of experience in office (and Swalwell doesn’t).

But Swalwell also has a political job and unless Corbett can win in November, she won’t. And does anyone really think Corbett would be running for Congress if she could stay in the Legislature?

It takes a strong ego and plenty of ambition and self-esteem to run for any political office and that’s not a bad thing.

If someone isn’t totally convinced that he or she is the best person for the job, why run? Heck, with Democrat Ro Khanna running unsuccessfully against the late Rep. Tom Lantos in 2004, considering a challenge to Stark in 2012 and now running against Rep. Mike Honda, it’s a question of whether there’s any Bay Area member of Congress he doesn’t think he could improve on.

And there’s the problem. For politicians – and aspiring politicians – it’s easy to fall into the trap of believing that the people need you in office, any office. And that it would be wrong to deny them the opportunity to get the skills and ideas you have to offer, even if those skills and ideas might not actually fit the office you’re seeking.

Birds gotta fly, fish gotta swim and politicians have to run for office. And sometimes that’s just too bad.

John Wildermuth is a longtime writer on California politics.