If I create an instance of a class, the autocomplete shows me property options when I use it. Each option has a hint which for me just shows (for example) “data - the ‘data’ property”
Can I make that something more meaningful?
If I create an instance of a class, the autocomplete shows me property options when I use it. Each option has a hint which for me just shows (for example) “data - the ‘data’ property”
Can I make that something more meaningful?
Can you show us an example of what you mean? Is this a Custom Component or a class defined in another module?
It’s my own class defined in a client module but often imported into server side modules :
class Response:
def __init__(self,data = None):
self._status = 0
self._text = ""
self._data = None
@property
def status(self):
return self._status
@status.setter
def status(self,value):
self._status = int(value)
@property
def text(self):
return self._text
@text.setter
def text(self,value):
self._text = str(value)
@property
def data(self):
return self._data
@data.setter
def data(self,value):
self._data = value
def serialise(self,**params):
status = params.get("status",self.status)
text = params.get("text",self.text)
data = params.get("data",self.data)
return {
"status":status,
"text":text,
"data":data
}
Oh, what a nice idea! Given that I recently had my grubby fingers in the autocompleter (for reasons you’ll see shortly ), I’ll make those properties honour doc-strings just like functions do.