Union of class variables

alex23 wuwei23 at gmail.com
Tue Feb 16 09:40:22 CET 2010


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



More information about the Python-list mailing list