Well you can actually select attributes if you do it in the outliner it looks something like follows:
{
$object = "|top|topShape";
$objnames=`ls -sl -l -o`;
$names=`ls -sl -l`;
string $newSel[];
for($i=0;$i<size($objnames);$i++)
if ($objnames[$i]==$object)
$newSel[size($newSel)]=$names[$i];
print $newSel;
}
But most likely users ask about channelbox selection Which is NOT a normal selection by the way,
channelBox -q -selectedMainAttributes mainChannelBox