In your __init__
, you have:
self.model = model,
self.color = color,
which is how you define a tuple. Change the lines to
self.model = model
self.color = color
without the comma:
>>> a = 2,
>>> a
(2,)
vs
>>> a = 2
>>> a
2
More Related Contents:
- Creating a class in python with several methods [closed]
- How do I call a parent class’s method from a child class in Python?
- Instance variables vs. class variables in Python
- Python: Bind an Unbound Method?
- Why do we use __init__ in Python classes?
- Explaining the ‘self’ variable to a beginner [duplicate]
- Python decorators in classes
- Why does a class’ body get executed at definition time?
- Getting an instance name inside class __init__() [duplicate]
- What is the difference between __init__ and __call__?
- Class that acts as mapping for **unpacking
- What is the purpose of the `self` parameter for methods?
- Private members in Python
- Prevent creating new attributes outside __init__
- Is there a way to instantiate a class without calling __init__?
- Difference between methods and attributes in python
- In class object, how to auto update attributes?
- overriding bool() for custom class [duplicate]
- How do I correctly setup and teardown for my pytest class with tests?
- Comparable classes in Python 3
- Why isn’t my class initialized by “def __int__” or “def _init_”? Why do I get a “takes no arguments” TypeError, or an AttributeError?
- How to get all methods of a Python class with given decorator?
- Python class @property: use setter but evade getter?
- What are the consequences of nesting classes? [closed]
- using import inside class
- NameError: global name is not defined
- Python mutually dependent classes (circular dependencies)
- Type Hinting for objects of type that’s being defined [duplicate]
- How to bind an unbound method without calling it?
- Get the object with the max attribute’s value in a list of objects