Are our major cities getting into the habit of electing mayors-for-life? You might think so, from recent election returns.

Edward Koch, under vociferous attack for seven years, wins 64 percent of the vote in New York's Democratic primary. Coleman Young, after 12 years in office, wins 64 percent in the primary in Detroit. Los Angeles' Tom Bradley won his fourth term last March.

In Washington and Cleveland and probably Philadelphia, all once the scenes of vigorous competition, mayors look forward to reelection without serious opposition. Baltimore's William Donald Schaefer is in his 15th year in office. Milwaukee's Henry Maier is past his 20th. San Francisco's Dianne Feinstein would win again in 1987 and Louisville's Harvey Sloane would have been mayor permanently since 1973 (he's now county executive) had it not been for limits in their citys' charters on the number of terms a mayor can serve.

True, not all mayors can expect to coast to easy victory. In Chicago, Harold Washington will face competition from his predecessor, Jane Byrne, and probably from others. Houston's Kathy Whitmire, supporter of a gay rights measure that was rejected by 80 percent of the voters, is facing her conservative predecessor, Louie Welch. But such races are the exceptions, not, as they used to be, the rule.

The mayors' races have changed, not so much because of the skills and personal idiosyncrasies of the successful mayors -- though most are skilled -- but because the central cities are changing, in ways that are producing a different kind of politics. I see four significant changes in demographics and attitudes:

1.Crime. Crime rates are down in most big cities. The lower crime rate reflects changes in attitudes not only among young men in the high-crime age group, but among city residents generally. In the 1960s and 1970s, many black city residents felt, justifiably, that the mostly white police forces were more likely to mistreat than to protect them, and that police brutality was a threat to even the most law- abiding black on the street. At the same time, many white city residents wanted to keep blacks off the police department for fear blacks would go on a rampage and whites would be physically threatened.

The key issue in politics in city after city was control of the police department. Would the white policemen, especially the large number who had signed up after World War II and were becoming eligible for pensions after 25 years, be replaced by blacks?

In large numbers they have been. But without all the dire results whites predicted. In time, black voters and politcians have come to see themselves less as victims of (usually white) brutal police and more as victims of (usually black) criminals. The (increasingly black) police came to be seen as allies, not oppressors. You can see the effects of this vividly in New York. Ed Koch was criticized loudly in 1983 and 1984 for allowing police brutality. But it wasn't much of an issue in 1985, and Koch ran first in most black assembly districts.

2.Demography. The harshest city politics took place in cities that were nearing a racial tipping point. But few cities are about to become majority- black today. Many already have (Washington, Baltimore, Detroit, Atlanta, New Orleans). Others have deeply enough entrenched white working-class communities that they're not likely to any time soon (New York, Philadelphia, Boston, Cleveland). As a result, voting patterns are less racially polarized: blacks, who often voted as a solid bloc in the past, gave Koch one-third of their votes in New York. Voters are increasingly willing to vote for candidates of the other race. The one exception is Chicago. Its demographic future is unclear; both blacks and whites have some reason to think they'll be in the majority in 1987 and years hence. Meanwhile, it has the most racially polarized politics of any big city.

3.Economic growth. Many central cities are now booming with new projects and growing in population. This is not so much the result of gentrification or yuppie babies as it is of immigration. The addition of a highly motivated, hard-working low-wage labor pool has swelled the population and stimulated the economies of central cities such as Los Angeles and Houston, and has affected even cities such as Chicago. Auto-dependent Detroit and steel-dependent Cleveland are still losing residents in large numbers. But Boston and San Francisco, after 30 years of population loss, have gained since 1980. So has New York; it gained more people in 1980-84 than any other city in the nation, as The New York Times trumpeted on its front page. Ed Koch benefited from the kind of civic pridand confidence New York had in the days of Al Smith and Fiorello LaGuardia, and from the contrast with John Lindsay, during whose terms the city lost 1 million (yes, 1 million) residents.

4.Lowered expectations. During the Lindsay years, politicians promised and voters expected city governments would solve residents' problems. Then New York faced bankruptcy, spending and services were cut, and expectations dropped. Voters increasingly look to growth in the private sector rather than growth in government to provide jobs and upward mobility.

So the job of mayor has been redefined to something well within the capabilities of a competent politician. It's too soon to say that Koch or Young or Bradley or any of the others are mayors-for- life. But it is clear that city politics -- and central cities -- have changed in important ways in the past 10 years or so.