2
def __init__(self, data=None, item=None, user=None, seed=1):
    """
    Parameterized constructor
    """
    # data for creating features
    self.data = data
    self.item = item
    self.user = user

Now how to check what is the type of data in self.data ?

petezurich
  • 9,280
  • 9
  • 43
  • 57
vaibhav
  • 158
  • 1
  • 12
  • 1
    Does this answer your question? [What's the canonical way to check for type in Python?](https://stackoverflow.com/questions/152580/whats-the-canonical-way-to-check-for-type-in-python) – Jan Christoph Terasa Jan 28 '20 at 07:22
  • Type checking itself is unpythonic, but if you must, use `isinstance()` (_not_ `type()`). – martineau Jan 28 '20 at 07:40

2 Answers2

0

You can use:

print(type(self.data))
print(type(self.item))
print(type(self.user))
wjandrea
  • 28,235
  • 9
  • 60
  • 81
Vaibhav Jadhav
  • 2,020
  • 1
  • 7
  • 20
0

Use type() function to get information about variable type:

class type(object)

With one argument, return the type of an object. The return value is a type object and generally the same object as returned by object.__class__.

Community
  • 1
  • 1
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141