$post
holds the post object that is being saved.
$post_ID
holds the ID of the post that is being saved.
You can get these parameters in your callback function when making your add_action
call.
example
add_action( 'save_post', 'my_save_function', 10, 2 );
The 10 represents priority - 10 is default, the lower the number, the higher the priority (i.e. run earlier).
The '2' in the last parameter is the number of arguments to pass to your callback. The default is 1, but as you state there can be 2 parameters here so you can up the value to get them both, if they are both needed.
function my_save_function( $post, $post_ID ) {
// Do stuff here.
}
There are lots of actions/filters with variable numbers of parameters that aren't known implicitly, so doing this way allows the code to be flexible.
In answer to why it wasn't included on the save callback - it's not needed in that instance. The $post
object provides a simple means of accessing the ID. You might want to include it in your own hooks - perhaps if you're altering the object for whatever reason, but really there are endless possibilities.
It's always best to do what you have done and check core for things like this, understanding what core is up to, makes developing with WordPress a lot easier :)