It is chiefly complaints by residents that have pushed the change. Locals in the central Bairro Alto and Cais do Sodre neighborhoods have been protesting the nightly throng of drinkers under their windows keeping them awake. In truth, both these areas have been packed with bars for decades. What’s arguably changed is the social make-up of the local population, one that in keeping with global patterns has become wealthier as city center living has become more fashionable. Walking these areas’ streets, it’s nonetheless easy to sympathize with their complaints. Streets in both areas are narrow and houses open straight onto the sidewalks, their walls providing perfect bouncing boards for every drunken roar and horsey laugh coming from the crowds that flocks here nightly.

How do you let your citizens enjoy nightlife while ensuring that other, early-rising residents can get some sleep? This week, Lisbon formalized its own answer to this question, one that many cities are grappling with.

The new regulations could help smooth out this disturbance. Formalizing temporary rules brought in a year ago, bars must close by 2am on weekdays and by 3am on weekends. Dance bars and clubs, meanwhile, can stay open until 4am if they are properly soundproofed. To keep noise off the streets, open-air terraces will need to be cleared by midnight. By American standards, these rules might sound exceptionally lenient, but Portugal has different social rules. While not as nocturnal as their Spanish neighbors (probably because unlike the Spanish, they’re not in the wrong time zone), the Portuguese tend to stay up late — even families with young children. Bearing this late-night culture in mind, it’s actually the ordnance concerning shops that seems draconian. In most of the city, they’ll have to shut by 10pm, making any late night shopping an impossibility.

Lisbon is keeping one exception to this rule, however—the waterfront. The banks of the Tagus estuary will become a 24-hour zone where night businesses have no limits at all on how long they stay open. That doesn’t necessarily mean that all bars and clubs here will stay open 24/7 just because they can, but the area should develop further as a special nocturnal quarter free from restrictions in place elsewhere. The area could scarcely have been better designed for such a purpose. Populated mainly with anonymous low-slung warehouses, it is separated from residential areas by a major road and a railway line, which run along the riverfront to avoid the need to tunnel into the steep hillside behind. Some bars and restaurants have already cropped up in this area, which will receive a tidy-up between now and 2017, eventually becoming a zone not just for nightlife but also for art galleries and daytime festivals.

The city authorities must be delighted to have such an obvious location for a 24-hour district. It is, after all, something that pro-nightlife activists in other cities are advocating for. Whether the waterfront will truly take off for these purposes remains to be seen. Alternative districts ordained from the top down can feel contrived, while restricting 24-hour opening to one small area may well push up rents there, creating an environment in which only the most mass market of venues are able to survive.

Still, for now Lisbon’s new rules look like a decent compromise that will keep sleep-hungry city residents happy—provided they don’t want to buy milk after 10pm.