Union of class variables [Solved]
Joan Miller
peloko45 at gmail.com
Tue Feb 16 03:59:19 EST 2010
On 16 feb, 08:40, alex23 <wuwe... at gmail.com> wrote:
> On Feb 16, 6:16 pm, Joan Miller <pelok... at gmail.com> wrote:
>
> > Is possible to get a third class with the class variables of another
> > two classes?
>
> > --------
> > class A:
> > foo = 1
>
> > class B:
> > bar = 2
> > --------
>
> Through multiple inheritance?
>
> >>> class C(A, B):
> ... pass
> ...
> >>> C.foo
> 1
> >>> C.bar
> 2
Yes! It solves the problem :) Thanks!
More information about the Python-list
mailing list