Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Drop Shadow behind ui.view()
-
@Phuket2 I wish I have a cool trick up my sleeve! But to comment on your response about not calling
super
: it is best practice to callsuper
when subclassing. This is because it allows you to refactor your code with less changes made afterwards.For example: let's say I someday make a kick-ass version of
UIView
andUIViewController
that makeui.View
look like children's toys. So, you want to incorporate the new view classes into your old code. The way you have, you would need to change every instance ofui.View.__init__(...)
. By callingsuper
you no longer have to do all that tedious work. It makes life slightly easier.I'm not saying that what your doing is wrong; I have plenty of classes that do the same thing. But o have started using
super
because of the refactoring issue.Now, this could all be a load of bullshit I am feeding you, so go look it up yourself and let me know if I'm correct! 😛
B.
-
@blmacbeth , hmmm, I am a little on the drunk side now 🎉😎 almost 11:30pm here now. So maybe I should wait until tomorrow to look it up 😱
But I started getting a problem when inheriting from multiple classes. Gets confusing about which base class is being called ( it did for me anyway). That's when I started using the implicit calls to base class's init methods instead. But I see your point though. I haven't managed to write anything significant enough in Python were it's been a problem to refactor 😭
Still trying though -
re needing to call View.init, see
https://forum.omz-software.com/topic/2548/inheritance-and-kwargs-popping-consumption/5If you do not implement your own init, you do not need to call super init.
If you have an init, you do need to call the View.init -
From what I've heard, you need to use
super()
for some aspects of multiple inheritance to work properly. I know almost nothing about the details of multiple inheritance on Python though, so I can't tell you why exactly that is and what would break otherwise. Mostly because multiple inheritance is not needed very often.