Anthony Weiner's yelling match with a voter last week made us wonder: What is it like to know you're about to lose an election? We spoke with two losing candidates to find out.

Weiner's frustration (though not necessarily its expression) is understandable. Political campaigns are zero-sum. You invest months of your time, huge amounts of money, and in one evening either learn you have a job for several years — or you have nothing. Even for staff, campaigns are tense and time-limited, efforts to balance a thousand priorities following a formula that ideally cobbles together the necessary votes for victory. The process of losing is so unpleasant that a number of former candidates we reached out to weren't interested in revisiting the topic.

Mel Gagarin was. In 2009, Gagarin ran for city council in New York's 29th Council District, an area in Queens that overlaps a little with Weiner's old congressional seat. Gagarin's candidacy, facing what was, in effect, two incumbents, was "an uphill climb from jumpstreet," in his words. But that didn't mean he didn't think he might win.

"I think two things happen" when you run for office, he told The Atlantic Wire by email. "One is you become trapped inside of your own campaign bubble and your own internal numbers of doors knocked, etc. That gives a false sense of hope. … Second is you've invested so much into it that it's almost impossible to admit defeat until the very end."

Tim Allison (pictured above) ran for Congress three years ago in California's 24th Congressional District, a region to the west of Los Angeles. (After redistricting, it's now mostly the 26th.) His race was a long-shot, given that he was a Democrat during the off-year in 2010, but he stayed hopeful, echoing Gagarin's sentiment.

I maintained optimism; volunteers and donors want to support a potential win, not a sure loss. I knew that unless the national tide suddenly turned great for Dems (unlikely in an off Presidential year), I was a long shot. Running for office is tough. It is stressful for yourself, your family and your budget. … If the candidate doesn't believe the campaign can win, then it can't.

As Gagarin said, "you have to sustain the feeling that you can overcome impossible odds in order to finish what you started." Neither candidate told most of their (small) campaign staffs about the likely defeat, though Allison suggested to his campaign manager at the outset that it was an uphill fight. Gagarin, at times, thought his staff "were the ones shielding me."

Allison said that knowing he wasn't likely to win made fundraising both difficult and a motivation. "[I]t is tough to ask for money, especially from those of limited means when the race is a long-shot," he said. But on the other hand, a former congressional candidate named Charlie Brown offered some insight:

… as soon as you start accepting checks from people who can't really afford to give, but do so because they believe in you, everything changes. At that point you have a responsibility to be in the race 100% and to run hard until the end.

Gagarin had an advantage that Allison didn't: unlike for New York City's mayoral candidates tomorrow, there weren't a lot of public polls showing he was behind. Voters, he said, never brought up the prospect of a loss. Allison, who was also hoping a 2010 run might make a 2012 bid easier, had a reply ready to go: "Sometimes change takes a couple of years."

One thing that helped Gagarin in the aftermath of the race was remembering that there was a lot that was out of his hands. In the moment, of course, "tempers flared," but "those times had nothing to do with knowing you were going to lose."

Allison had some advice for candidates that might face the prospect of a loss — including one likely to lose tomorrow in New York.

Candidates like [Weiner] of New York, I think, have their ego and whole identity wrapped up in the title and all that goes with it. An office gives you the platform to make a difference in the world, but there are other platforms, many of them better. If you face defeat and victory with dignity and grace, other doors leading to great opportunities are more likely to open.

Oh, and if you were wondering: Neither candidate prepared a concession speech.