1

Let's see my class (look at ????)

class MyInt(object):
    def set_value(_value):
        if type(_value)!=int:
            type_name = type(_value).__name__)
            raise Exception("value of %s cannot be %s" % (????,type_name))
        self.value = _value

And ...

x = MyInt()
x.set_value(1)

that's ok, and ...

x.set_value("A")

I need this response (best description):

value of x cannot be str

How can i get "x" (at ????), or pass variable name as argument (implicit)

tnx

0 Answers0