If the office of district attorney is vacant the duties of the office may be temporarily discharged by a chief deputy district attorney, assistant or deputy district attorney, as the case may be, next in authority to the district attorney, in office at the time the vacancy occurs, with like authority and subject to the same obligations and penalties as the district attorney, until the vacancy in the office is filled in the manner provided by law.