I am trying to utilize Python classes for defining and organizing functions that will make Rest API calls. The functions are interrelated to some extend and hence I am trying to use Classes to organize them. The structure I have in mind is as below:  Main_Class (holds the common variables and funcs. like say clean_dict()) | |-- Sub_Class1  |   (Modifies the URL to access some Service 1) |       |-- Func1 (makes the actual API call and returns result) |       |-- Func2 |-- Sub_Class2 |   (Modifies the URL to access some Service 2) |       |-- Func1 (same name, but unrelated to above Func1) |       |-- Func3   Currently I have written this as Nested Classes. From within the __init__ of Main class, I initialize the subclass objects too and pass some variables to it. This allows me to call the functions within subclass like below. This is something I want to do because its looks cleaner to me and provides someone who reads code later an idea where everything is coming from:  main = main_class(common_args) var1 = main.subClass1.Func1(specific_args_for_this_func) var2 = main.subClass2.Func1(specific_args_for_this_func) var3 = main.subClass1.Func3(specific_args_for_this_func)   Issue is, I want to use the common clean_dict() function defined in Main class within the subclass functions. With Nested Classes, I understand this wouldn't be possible.  So, what is the best approach so that    I can keep the structure of how I call the functions with dot notation and While being able to access some common function defined in a main/parent class?   From my understanding, if I do class inheritance instead, I would have to initialize each subclass separately and code would be like below:  subClass1 = Sub_Class1(common_args) subClass2 = Sub_Class2(common_args) var1 = subClass1.Func1(specific_args_for_this_func) var2 = subClass2.Func1(specific_args_for_this_func) var3 = subClass1.Func3(specific_args_for_this_func)   I guess it goes without saying that I am only an intermediate level programmer and hopefully answer to this wouldn't be too complex.
There are two schools of thought on how to best extend, enhance, and reuse code in an object-oriented system:   Inheritance: extend the functionality of a class by creating a subclass. Override superclass members in the subclasses to provide new functionality. Make methods abstract/virtual to force subclasses to "fill-in-the-blanks" when the superclass wants a particular interface but is agnostic about its implementation. Aggregation: create new functionality by taking other classes and combining them into a new class. Attach an common interface to this new class for interoperability with other code.   What are the benefits, costs, and consequences of each? Are there other alternatives?  I see this debate come up on a regular basis, but I don't think it's been asked on  Stack Overflow yet (though there is some related discussion). There's also a surprising lack of good Google results for it.
i want to add watermark on some videos but problem is because image in some videos its too small and in some videos its too big, (i think it depends on input link resulution)   so all my videos have output '640:360' so how can i make watermark image to be same in all videos not on some videos smaller in some bigger   ffmpeg -i "link" -i "/var/www/logo/logo1.png" -filter_complex 'overlay=10:10' -vcodec h264 -crf 25 -preset superfast -maxrate 600k -bufsize 600k -aspect '640:360' -s '640:360' .... To select a child node in jQuery one can use children() but also find().   For example:  $(this).children('.foo');  gives the same result as:  $(this).find('.foo');  Now, which option is fastest or preferred and why? Google Maps choose zoom to fit country TIGHTLY in given window While moving custom profiles using eclipse from dev org to partner org found following errors How do I evaluate several n-th derivatives of a function at one point? How much longer will my 10 year old frame last? Difference between declaring variables before or in loop? Residue fields of schemes of finite type (over $\mathbb{Z}$) Suppose $X$ is a scheme of finite type over $\mathbb Z$. I want to prove that:  (1) The residue fields of closed points of $X$ are finite;  (2) For a given $q=p^n$ with $p$ prime, there is only a finite number of closed points of $X$ whose residue field is $\mathbb F_q$.  For (1), I see that one has to use some form of Nullstellensatz. First, we suppose $X=\operatorname{Spec}(A)$ affine, and $A=\mathbb{Z}[X_1,...,X_n]/I$. We need to show that if $m$ a maximal ideal of $A$, then $A/m$ is finite. Note $p=\mathbb Z\cap m$. If $p$ is maximal, we get that $A/m$ is of finite type over $\mathbb F_p$ thus a finite extension by Nullstellensatz and we are done. But $p$ could be the $(0)$ ideal in which case I neither conclude nor get a contradiction.  For (2), we can again argue locally, so we need to show that $A$ contains only a finite number of maximal ideals $m$ with $A/m$ of fixed cardinality $q=p^n$. I get an impression that to count these ideals its the same as to count the number of automorphisms of $\mathbb{F}_{q}$ which fix $\mathbb F_p$, but the corrspondence is not bijective, so we only get an upper bound which is enough. Is this idea correct? Quotient group $G/H$ is abelian iff $[G,G] \subseteq H$ What is the difference between a homepage link with or without a trailing slash? How to separate iMessages with shared Apple ID? My son and wife both have iPod Touches and I have an iPhone. We all used the same Apple ID and turned on iMessage. Both my son and wife were getting texts from my friends and my work on their iPods, I think because my cell phone number was linked to the Apple ID.  If I just turn off iMessage on my iPhone, will that solve the issue? Subset of $C[0,1]$ is nowhere dense Uncaught exception thrown after moving my website to localhost Downgrade nVidia Shield to Android 4.4 KitKat How do I change my update server in Ubuntu 18.04? The first thing I did after installing 16.04 LTS was to change my update server to Main Server. I can not find a similar option in Ubuntu 18.04.  How do I change it? I know how much space is required to install Ubuntu.  How much space does a Ubuntu installation take up on the disk? How am I supposed to install El Capitan on a new SSD without recovery partition? Self-Contained Proof that $\sum\limits_{n=1}^{\infty} \frac1{n^p}$ Converges for $p > 1$ To prove the convergence of the p-series   $$\sum_{n=1}^{\infty} \frac1{n^p}$$  for $p &gt; 1$, one typically appeals to either the Integral Test or the Cauchy Condensation Test.  I am wondering if there is a self-contained proof that this series converges which does not rely on either test.    I suspect that any proof would have to use the ideas behind one of these two tests. Cannot change lock screen background on Ubuntu 18.04 ''will'' or ''going to''