Preheat oven to 350°F (180°C). Grease and flour a 9×5-inch loaf pan.
In a medium bowl, whisk together the flour, baking powder, baking soda, and salt.
In a large mixing bowl, cream the butter and sugar together until light and fluffy. Add the eggs one at a time, mixing well after each addition. Stir in the vanilla extract and mashed bananas.
Gradually add the dry ingredients to the banana mixture, mixing until just combined. Stir in the chopped walnuts, if using.
Pour the batter into the prepared loaf pan and bake for 60-70 minutes, or until a toothpick inserted into the center comes out clean.
Let the bread cool in the pan for 10 minutes before transferring it to a wire rack to cool completely.