Well, if I paste that code into a Python 2.7.10 iPython session, using a stub/empty FloatLayout class, then the error I get from instantiating with just a string, and calling the getIngredient() method, is:
AttributeError: 'str' object has no attribute 'name'
... which seems perfectly expectable. If I create some object and give it a .name
attribute then the code works fine.
So it seems likely that your problem either involves some details of the real FloatLayout parent class; or the version of Python that you're using (or both).
In general I'd expect that you'd add your own custom attributes (.ing
in your example) before your call to super()
... if you're adding stuff rather than over-riding it. (In general I'd also expect you to pass any initialization arguments up the chain to your super-classes (after filtering out any that you're intercepting as specific to your derived/child class). Done properly that should make you relatively robust even if the implementation of your parent class changes somewhat and even if descendants of your class attempt to utilize as yet un-imagined extensions of your parent classes.
(I know, that sort of "future proofing" is vague, and abstract, and even somewhat fragile ... but it's better than ignoring the issue entirely).