Use the super() builtin function. It returns an object that has the ability
to instantiate your parent class. see sample code:
class Animal(object):
def __init__(self,*args,**kwargs):
pass
#print(types,'Base class with Animal')
class Mammal(Animal):
def __init__(self):
super().__init__('Child classs for mammal')
print('Child Class for mammal')
m = Mammal()
The output:
usr/bin/python3.6 /home/bug/PycharmProjects/pydummies/graphics/one.py
Child Class for mammal
Process finished with exit code 0
Thanks.
On Wed, 3 Oct 2018 at 17:43, <[email protected]> wrote:
> how i can call super class instance varibles in subclass (python3)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f6a92d85-7311-4f7a-8460-185a51b20154%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f6a92d85-7311-4f7a-8460-185a51b20154%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAEEZZ8LdZbF1XM2ByxCgSZq3R7mCSSCVvLz-MfiDqbhS%3DuqdqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.