rename duplicated object without selecting it
I´m new to scripting and have one simple question. could not find anything in the command ref. when duplicating an object, is there a way where I can rename this newly created object within the same command? I mean nothing like picking the new object with a new command, cause I can´t know how maya will name it.. like ->
duplicate polyToSubd1 ;
// Result: polyToSubd4 //
rename "polyToSubd4" "tmp_side1";
duplicate polyToSubd1 [-rename duped result "tmp_1"] ;
thx in advance!