While I was doing dl1/lesson3-head-pose.ipynb I got interested how in fastai source code of data_block.py and I had problems with _ _ getattr _ _ method from class LabelList(Dataset):
at the end it has raise AttributeError(k) which always gets hit because the return value is blocked by unsatisfied if statements.
What I don’t understand is why the program continues to run and doesn’t show this exception. Is this a a python/fastai bug or everything work fine? Is this because getattr evaluates exception as false and doesn’t have to stop? I even added print statement after that- it’s not printed so the function is not executed to the end after hitting raise but console stays quiet… Can anyone explain this to me?
This method is called by if getattr(ds, ‘warn’, False) from class LabelLists(ItemLists): process() method
Above is called by _ getattr _() from class ItemList(), bacease data.label_from_func(get_ctr) from class ItemLists() has no such a method as label_from_func (it belongs to class ItemList()). Before process
_label_from_list called by label_from_func() from class ItemList() is called twice (for train and valid sets) to do the labelling job.