FLINT, Mich. -- The campaign for the Democratic presidential nomination is supposedly over, with former Secretary of State Hillary Clinton clearly ahead of Vermont Sen. Bernie Sanders and on her way to capturing a majority of delegates.

But for two hours on Sunday night, Clinton and Sanders debated as if the outcome was very much in doubt -- sparring over everything from trade and corporate welfare to health care and guns.

The debate, held in Flint, Michigan, was feisty and even cantankerous. Clinton and Sanders had several exchanges where they tried to talk over one another; Sanders, as always, brought his full array of facial expressions.

But the debate was also deeply substantive -- an argument between two seasoned politicians who have obviously given a lot of thought to the problems facing America, and what they would do about them.

The contrast to the Republican debate from last week, with its juvenile insults, could not have been more stark. Instead of discussing penis length, Clinton and Sanders argued over the sizes of their respective infrastructure programs.

In short, both Clinton and Sanders looked ready for prime time.

The debate began, appropriately, with an extended discussion of Flint’s water crisis -- and what the candidates would do, both to help the people of Flint who suffered because of lead in the water and to prevent future tragedies. And it was one of the few discussions of the night when Clinton and Sanders were more or less saying the same thing. Both called for setting up programs for Flint families, both demanded the resignation of Michigan Gov. Rick Snyder (R), and both called for testing of lead in pipes across the country.

Sanders said that it is “beyond belief that children in Flint, Michigan in the United States of America in the year 2016 are being poisoned. That is clearly not what this country should be about.”

Clinton said, “This is not the only place where this kind of action is needed. We have a lot of communities right now in our country where the level of toxins in the water, including lead, are way above what anybody should tolerate. … I want to tackle this problem across the board.”

But then an audience member from Flint asked what the candidates would do to keep manufacturing jobs from leaving the country -- and the sparks started flying. Clinton said she wanted to use a mix of “carrots and sticks,” by which she meant new incentives to create factories in the U.S. and a proposal (just announced a few days ago) to “claw back” tax breaks from companies that transfer operations overseas.

Sanders used the occasion to pounce -- attacking Clinton, as he has before, for backing the North American Free Trade Agreement and other trade deals. “I am very glad … that Secretary Clinton discovered religion on this issue, but it's a little bit too late,” Sanders said.

“Secretary Clinton supported virtually every one of the disastrous trade agreements written by corporate America.”

Scott Olson/Getty Images Clinton and Sanders got into it over trade, guns and pretty much everything else on the domestic agenda.

A series of contentious exchanges followed. Clinton attacked Sanders for voting against gun control measures, while Sanders attacked Clinton for going soft on Wall Street. They fought over the Export-Import Bank, the controversial government program that is supposed to help American companies that sell their wares overseas. Clinton supports it, saying it provides critical support for American jobs; Sanders opposes it, calling it a form of corporate welfare reform.

Clinton at one point attacked Sanders for opposing President Barack Obama’s rescue of the auto industry, saying that Sanders had voted against it. It’s an argument she hadn’t made before, and the Sanders campaign pointed out that the senator had taken other votes to support the rescue -- and had defended it publicly on a radio show.

But, as debates go, this one had relatively few instances of campaigns challenging each other on the basic facts. Instead, the sharp debate offered Democratic Party voters a clear sense of the choice they face in this primary campaign. Stylistically, Clinton measures her words carefully, while Sanders relishes every chance to say something blunt or bold. Clinton talks about programs, while Sanders likes to invoke big themes. Clinton talks about what she can do, while Sanders talks about what he’d like to do.

A classic case was an exchange the two had over infrastructure. Clinton rattled off her plans for more than $200 billion in new infrastructure spending, including the creation of a so-called infrastructure bank. Sanders noted that he wanted to invest more than four times that much -- $1 trillion, over five years -- not just to shore up infrastructure but also to create millions of new jobs. Clinton would say her approach is more realistic; Sanders would say his approach is more appropriate for an economy performing well under capacity.

Of course, there are real and important differences between the two. Sanders thinks that taking donations from Wall Street is singularly corrupting, while Clinton thinks it’s possible to take Wall Street money while still being tough on the financial industry in office. Sanders wants to replace the health care system with a government-run, “single-payer” health insurance scheme, while Clinton has said she wants to build on the Affordable Care Act, further expanding and bolstering insurance coverage step by step.

But on virtually all of these issues -- with the notable exception of trade, on which Donald Trump says things that sound a lot like Sanders -- the philosophical difference between Clinton and Sanders is tiny compared with the difference between Democrats and the Republicans running for president. Near the end of the debate, both Clinton and Sanders noted that they still have a lot in common -- and that voters would be better off with either of them than with a Republican.

“We’re going to invest a lot in mental health,” Sanders quipped. “And if you watch these Republican debates, you know why we need to invest in mental health.”