I should say, although it has the same effect, is that what inherits from general to peer is the list of allowed codecs, rather than the individual allow and disallow lines.
While not directly related right now just as an FYI:
In the future things are moving away from such patterns and going towards usage of template inheritance instead. For example the new PJSIP channel driver doesn’t expose configuration like that in a general section.
In case you’ve never encountered templates they can be used like this: