A lot of our models have
# Invoke setter
self.name = name
self.site_role = site_role
if auth_setting:
# In order to invoke the setter method for auth_setting,
# _auth_setting must be initialized first
self.auth_setting = auth_setting
So they set the _var to None and then set it again a few lines later to the item passed in to __init__ -- but in python the class is fully constructed by the time __init__ gets called, so we can just call the setter directly from there, no need to set to None
http://stackoverflow.com/questions/3941919/how-to-set-a-python-property-in-init
@RussTheAerialist if you don't object I want to make a PR that cleans this up -- less code makes the classes easier to read to me, so I can distinguish between what actually needs to be None vs what's getting set when you instantiate the class.
A lot of our models have
So they set the
_vartoNoneand then set it again a few lines later to the item passed in to__init__-- but in python the class is fully constructed by the time__init__gets called, so we can just call the setter directly from there, no need to set toNonehttp://stackoverflow.com/questions/3941919/how-to-set-a-python-property-in-init
@RussTheAerialist if you don't object I want to make a PR that cleans this up -- less code makes the classes easier to read to me, so I can distinguish between what actually needs to be
Nonevs what's getting set when you instantiate the class.