We study the effects that school choice mechanisms and school priorities have on the degree of sorting of students across schools and neighborhoods, when school quality is endogenously determined by the peer group. Using a model with income or ability heterogeneity, we compare the popular Deferred Acceptance (DA) and Boston (BM) mechanisms under several scenarios. With residential priorities, students and their households fully segregate into quality-ranked schools and neighborhoods under both mechanisms. With no residential priorities and a bad public school, DA does not generate sorting in general, while BM does so between a priori good public schools. With private schools, the best public school becomes more elitist under BM.