By Max Deveson
BBC News, Washington
In order to pass their political driving test, successful politicians need to be masters of one tricky manoeuvre in particular - the U-turn.
The candidates have shifted their positions on a number of policies
The contenders in this year's US presidential election are no exceptions - both John McCain and Barack Obama have engaged in some nifty repositioning.
Mr McCain's U-turns have mostly increased his appeal to the Republican Party's base, placing him on a rightward trajectory.
Barack Obama has been performing a more traditional manoeuvre: running to the left during the primaries, when party activists need to be wooed, then shifting to the centre once the nomination is clinched.
Flip-flopping politicians will always attract charges of hypocrisy and opportunism: it may be worth it if it helps them win over undecided voters in the middle, but when the goal is to shore up their political base, the benefits are much less clear.
Here are some examples.
Having long been a member of his party's more moderate wing on a number of issues, Mr McCain began adopting more right-wing positions during the primary campaign.
Last year, Mr McCain was one of the key backers of President Bush's plan for "comprehensive immigration reform", which would have created "paths to citizenship" for illegal immigrants, while investing more money in border security.
The plan was very unpopular with the Republican rank-and-file, and Senate Republicans succeeded in blocking the scheme.
During the primaries, Mr McCain announced that his immigration focus would be on securing America's borders, rather than on giving illegal immigrants the chance to become US citizens.
"I understand why you would call it a, quote, shift," McCain told reporters in November 2007.
"I say it is a lesson learned about what the American people's priorities are. And their priority is to secure the borders."
Another McCain, quote, shift was in his relationship with the religious right of his party.
During his 2000 bid for the Republican nomination, relations between Mr McCain and Moral Majority founder Jerry Falwell were notoriously fractious.
The Arizona senator memorably described Mr Falwell and fellow members of the religious right as "agents of intolerance".
But in 2006, ahead of his second presidential run, Mr McCain delivered the commencement address at Mr Falwell's Liberty University, after which he attended a small private party hosted by his former political adversary.
More recently, Mr McCain angered his former allies in the political centre by supporting a bill exempting the CIA from following the same rules on interrogation as the US Army.
Mr McCain was one of the most prominent Republican voices opposed to the Bush administration's detention policy in Guantanamo Bay.
But when the Supreme Court recently ruled that Guantanamo detainees should have access to US courts, Mr McCain described it as "one of the worst decisions in the history of the country".
Since sewing up the Republican nomination in March, Mr McCain - one of only a few prominent Republicans to accept the argument that human activity is causing climate change - has dropped his previous objection to lifting the ban on oil exploration off the coast of the US.
Since clinching the Democratic nomination, Barack Obama has also been making headlines for his policy shifts.
Last month he announced that he would be rejecting public financing for his campaign, and would instead rely on private donations.
The McCain camp accused Mr Obama of "going back on his word", although Mr Obama insisted that he had never made a promise to stay in the public finance system.
Mr Obama also raised eyebrows when he announced that he would not be opposing a bill going through Congress giving immunity to telephone companies involved in the Bush administration's controversial warrantless wiretap programme.
His decision angered many of his supporters on the left, who accused him of going back on his 2007 pledge "to support a filibuster of any bill that includes retroactive immunity for telecommunications companies".
When the Supreme Court decided to overturn Washington DC's handgun ban, Mr Obama declared that the ruling "provide[d] much-needed guidance", despite having previously argued (in a written answer that he says was drafted by an aide and which he had not approved) that the ban was constitutional.
Withdrawing troops from Iraq has long been one of the central planks of Mr Obama's campaign, and was something that set him apart from other Democratic candidates running for the party's presidential nomination.
Since his campaign began, however, conditions in Iraq have changed, violence has reduced, and some commentators have suggested that Mr Obama's position is out of date.
Mr Obama himself has announced that he plans to visit Iraq, where he will make "a thorough assessment" which could lead him to "refine" his policy.
Some critics have seized on this as an indication that Mr Obama is laying the groundwork for a change in position.
Mr Obama recently hinted to Fortune magazine that his strong anti-free trade rhetoric during the primaries may not be reflected in his actual trade policy should he become president.
His remarks are a neat summation of the pressures and temptations that lead politicians to shift their positions during the process of running for office.
"Sometimes during campaigns the rhetoric gets overheated and amplified," he said.
"Politicians are always guilty of that, and I don't exempt myself."