In truth, though, Bloomberg was Trump’s antithesis. Where Trump projects the stereotype of the rich man as hustler, Bloomberg’s values were noblesse oblige; he styled himself as one whose riches liberated him from petty favor-trading. His hallmark was a largely nonideological, pragmatic approach to problem-solving.

In the tradition of the original progressives — politicians like Theodore Roosevelt and Woodrow Wilson — Bloomberg placed expert knowledge and judgment over partisan loyalty. (He had no party to be loyal to, changing his affiliation from Democratic to Republican to independent and back to Democratic.) He hired academics and technocrats of various political hues, from his transit chief Janette Sadik-Khan, who introduced Citi Bikes and closed part of Times Square to cars, to his public health czar Thomas Frieden, who led the way to banning smoking in restaurants and distributing condoms in schools. His education policies were less sure-handed, with Bloomberg getting swept up into the early-21st-century vogue for charter schools. But Randolph defends him here, too, at least partly, arguing that he pared back the bureaucracy, expanded school choice and raised teachers’ salaries to retain able educators. Falling crime rates also persuaded families to stay in the city and keep their kids in public schools.

Randolph doesn’t hold back from discussing Bloomberg’s failures. One biggie was the West Side Stadium debacle. Many of Bloomberg’s infrastructure projects proved farsighted, like the Barclays Center in Brooklyn, the High Line park in Chelsea and the Cornell Tech campus on Roosevelt Island. But the ill-conceived scheme to erect a monstrous sports arena would have disrupted life up and down the West Side of Manhattan and handed a multibillion-dollar gift to the New York Jets. Only its defeat by the State Legislature in 2005 defused public anger. (Randolph is admirably candid about the hedging of the Times editorial board on the issue.)

Controversial, too, was the huge rise in what the police commissioner Ray Kelly called “street stops,” more commonly known as “stop and frisk.” Because the police targeted high-crime neighborhoods, these stops, which climbed from 97,296 in 2002 to 685,724 in 2011, disproportionately affected black and Hispanic residents. Bloomberg defended Kelly’s methods, which may indeed have helped reduce violent crime in minority communities, but in 2013 a district court judge found the application of the policy to be unconstitutional. Compared with the raw antagonism of the Giuliani years, racial conflict in the city subsided substantially under Bloomberg, yet his overly aggressive policing would remain a sore spot.

The other major disgrace was his suspension of mayoral term limits. In 1993, New Yorkers had restricted their mayors to two terms. But as 2009 approached, Bloomberg — who had called a previous bid to undo term limits “an outrage” — strong-armed the City Council to allow him a third term. The body voted yea, Randolph notes, “as the crowd booed and someone yelled ‘Shame on you.’” The power play highlighted what people disliked about Bloomberg: his higher regard for himself than for the people. In November 2009, despite two accomplished terms, Bloomberg barely beat the humdrum William Thompson, the city comptroller, by just 4.4 percent — a drop of more than 15 percent from 2005.

One critic who thundered against the power grab was an obscure Brooklyn city councilor named Bill de Blasio, who in 2013 rode the issue to the mayoralty himself. Now, of course, de Blasio is roundly disliked. His two appearances on the Democratic presidential debate stage have invoked in many a surge of nostalgia for Bloomberg.

But make no mistake: Bloomberg’s data-driven, pragmatic style of governance is increasingly falling out of favor, as both political parties, to varying degrees, embrace a rigidly moralized politics. Indeed, in today’s fiercely partisan climate, Bloomberg probably couldn’t get elected mayor. That this idiosyncratic and flawed but ultimately highly effective technocrat served for the 12 years between 2002 and 2014 was the strange result of a man being unexpectedly aligned with the historical times — or, we might say, something of a fluke.