[Ohrrpgce] FirstChild vs GetChildByName

Ralph Versteegen teeemcee at gmail.com
Fri May 6 03:40:22 PDT 2016


On 6 May 2016 at 10:01, James Paige <Bob at hamsterrepublic.com> wrote:
> I just noticed that the reload functions FirstChild and GetChildByName seem
> to be almost exactly the same.
>
> GetChildByName's name argument is not optional, and it has something that
> appears to be a speed optimization
>
> Is there any reason not to combine them? (probably by removing
> GetChildByName, and maybe adding its optimization to FirstChild?)
>
> ---
> James

Yes, they could be combined, if "GetChildByName" in reloadbasic.py is
also replaced. The only possible reason not to is that it's not
obvious that the two functions are equivalent, so you won't know to
look for one when you want the other. I guess FirstChild may be the
better name because it's short :) and because it draws attention to
the fact that you get the other children with that name with
NextSibling. Alternatively we could removing the name argument to
FirstChild so there's no overlap.

I hardly remember adding that optimisation to GetChildByName, but
would like to keep it.


More information about the Ohrrpgce mailing list