You are not creating an instance, but instead referencing the class Goblin
itself as indicated by the error:
AttributeError: type object ‘Goblin’ has no attribute ‘color’
Change your line to Azog = Goblin()
More Related Contents:
- What are metaclasses in Python?
- Static class variables and methods in Python
- What is the purpose of the word ‘self’?
- What is the meaning of single and double underscore before an object name?
- Usage of __slots__?
- Using property() on classmethods
- Why do you need explicitly have the “self” argument in a Python method?
- Iterate over object attributes in python [duplicate]
- Python – Classes and OOP Basics
- Difference between methods and functions, in Python compared to C++
- Failed to catch syntax error python [duplicate]
- How to avoid infinite recursion with super()?
- List all base classes in a hierarchy of given class?
- Why is `object` an instance of `type` and `type` an instance of `object`?
- Understanding the difference between __getattr__ and __getattribute__
- Python: how to “kill” a class instance/object?
- What is the purpose of the `self` parameter? Why is it needed?
- difference between variables inside and outside of __init__() (class and instance attributes)
- @classmethod vs @staticmethod in Python
- How to setup environment variable R_user to use rpy2 in python
- How do I access Class member variables?
- What is the purpose of static methods? How do I know when to use one? [duplicate]
- Is there a benefit to defining a class inside another class in Python?
- How do I set and access attributes of a class? [duplicate]
- How to assign a new class attribute via __dict__?
- Correctly extend a tkinter widget using inheritance
- Should I use a class or dictionary?
- Python – Testing an abstract base class
- How to replace an instance in __init__() with a different object?
- pick a subclass based on a parameter