Sullivan Fortner, a gifted 29-year-old pianist I had never heard before, played a fiery, shape-shifting piece new to me as the first selection in his debut performance at the Appel Room at Jazz at Lincoln Center last Friday. Fortner was brought on as a guest of the featured artist, pianist Fred Hersch. “That wasn’t planned, and it wasn’t rehearsed,” Fortner said at the completion of the piece, sounding proudly surprised by the quality of his own spontaneous composition. “I don’t know what that was!”

The audience oohed and aahed, clearly impressed by Fortner’s creative ingenuity, and the drama of the moment got me thinking about Donald Trump. I should make clear here that I am anything but a Trump supporter. In fact, I find his wild and volatile, xenophobic, hate-fueled rhetoric loathsome and terrifying. I have never understood any aspect of his appeal—until the night at the Appel Room, when it struck me that the very wildness and volatility of Trump’s performances in campaign rallies, debates, and television interviews do not look to everyone like liabilities. They come across as strengths to his admirers. Like Sullivan Fortner and every other musician skilled in the art of extemporaneous invention, Donald Trump is, in his way, an improviser—in a perverse sense, a jazz candidate.

Since the beginning of his campaign for the Republican nomination seven months ago, he has flaunted his contempt for the time-consuming conventions of study, preparation, and measured, well-considered opinion. He takes things as they come, never at a loss for something to say—often, something startling and groundless and headline grabbing, regardless of its possible incompatibility with something he has said before.

His critics in and out of the press, duly rankled by Trump’s smug unpreparedness, tend to see his impulse to ad lib as a shortcoming that is, in and of itself—apart from the problematic content of his blurtage—unbecoming to a serious contender for the presidency. Trump is “like a kid saying the first thing that pops into his head,” in the words of David Horsey, the political columnist for the Los Angeles Times. “Trump is just winging it; coming up with answers to questions without really taking much time to think.”

As Gail Collins proposed on The New York Times op-ed page, puzzling over the wondrous variety of figures Trump has suggested for a tariff on imports from China, “a possible answer would be that he just makes this stuff up as he goes along.”

The presumption underlying these comments is that Trump’s habit of “winging it” indicates a lack of intellectual discipline, a disconnect from reality, and a mercurial personality unsuitable to leadership. I think all this is true, and it troubles me profoundly. At the same time, I see now how the ease with which Trump makes stuff up as he goes along can be mistaken for an attribute.

The ability to improvise, be it in a jazz band or on the campaign stump, is potent demonstration of resourcefulness—not unpreparedness, arguably, but its opposite: a readiness to take anything that hits and, without losing a second for reflection, come up with a way to deal with it. Part of the cool that we associate with jazz artists comes from the musicians’ much vaunted intuitiveness and resilience—the capacity to function in the face of the unknown and cook up something attention grabbing and impressive-sounding on the spot.

In and out of jazz through the history of American popular culture, from Charlie Parker and Miles Davis to Sam Spade and Indiana Jones, quick-witted improvisers have been valorized as heroic figures. Humphrey Bogart, as Spade in The Maltese Falcon, anticipates James Bond and his countless imitators as he wings his way out of one oddball crisis after another, inventing personas and hatching improbable cover stories. Harrison Ford, as Jones, nods playfully to what was by his time a long improvisational tradition in action movies, serials, and pulp fiction.

“I’m going after that truck,” Jones tells his friend Sallah in Raiders of the Lost Ark.

“How?” Sallah asks, speaking for the whole audience.

“I don’t know,” Jones explains. “I’m making this up as I go!”

Being a method suited to the short term but lacking a long-term plan, making it up as he goes served Indiana Jones considerably better than it does Donald Trump. It gets Trump through the moment—the fleeting news cycle of the WhatsApp era—while keeping him on the apparent brink of disaster and doing nothing to carry him through the moment ahead, thus ensuring the need for him to make up something else soon. Unlike the improvisers of fiction, fortunately, Donald Trump has no certainty of survival in the last reel to sustain him through Election Day; he has only his wile, for as long as it holds out.

As with jazz musicians, the creative freedom Trump enjoys is one with unseen limits. After all, in jazz, the illusion of playing whatever one wants is merely an illusion. Improvisation takes place in most jazz music within the formal constraints of the composition’s harmonic structure and the melodic or thematic motifs. Jazz musicians prepare rigorously to improvise within sets of prescribed frameworks; and in band settings, they do so cooperatively, listening attentively and responding empathetically to others.

Donald Trump knows how to make a lot of unexpected noise. But that ability alone would take him only so far. Without the willingness to prepare and the capacity to work within an established structure, to cooperate, to listen, and to engage others with empathy, he’d get blown off the bandstand.