R
Rita
I would like to do some data validation when its going to a class.
class Foo(object):
def __init__(self):
pass
I know its frowned upon to do work in the __init__() method and only
declarations should be there.
So, should i create a function called validateData(self) inside foo?
I would call the object like this
x=Foo()
x.validateData()
Is this the preferred way? Is there a way I can run validateData()
automatically, maybe put it in __init__? Or are there other techniques
people use for this sort of thing?
class Foo(object):
def __init__(self):
pass
I know its frowned upon to do work in the __init__() method and only
declarations should be there.
So, should i create a function called validateData(self) inside foo?
I would call the object like this
x=Foo()
x.validateData()
Is this the preferred way? Is there a way I can run validateData()
automatically, maybe put it in __init__? Or are there other techniques
people use for this sort of thing?