A 4-foot fence might be enough, especially if you're starting with a puppy because you can start 'fence training' early -- no jumping on the fence, no paws on the fence for any reason whatsoever, etc. Once your pup gets bigger, I wouldn't leave him/her unsupervised with just a 4-footer, though.
The main thing I don't like about electric fences is that, while it might keep your dog in, it won't keep anything else OUT.
We noticed something interesting the other day, when we were driving down one of our side streets here. We too have a city ordinance - 6 foot maximum. Someone obviously wanted a little more height, so they attached about a 12-inch piece of lattice onto the top of their wooden fence and trimmed it all out and everything so it looks real nice. It's not technically part of the fence per se, it's just "decorative trim" so they're able to get around the ordinance. That might be something for you to consider. It's probably not very expensive to do, would give you another foot or so in height and if your city says it has to go, you could just detach it and stick with the 4-foot fence.