How to interact with another wordpress install on same database?

Reading through the source code for the wpdb class, I see no reason why something like this shouldn’t work:

$otherdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
$otherdb->prefix = 'wp2_';

And then (if I’m understanding this right) you can use all the existing $wpdb methods and variables. Eg:

$x = $otherdb->get_results( $sql_query );

(If I’m wrong — or if this is bad practice for reasons I haven’t considered — please feel free to correct me.)