I don't know if there's some precedent for submitting templates that we think are useful, but here's one that I copied from TextMate's python bundle that's pretty nifty and comes in handy.
It sets up for you the basic code to create a property in your class def. I have it bound to `prop` but you can bind it to what you think is most appropriate:
Hi all,
I don't know if there's some precedent for submitting templates that we think are useful, but here's one that I copied from TextMate's python bundle that's pretty nifty and comes in handy.
It sets up for you the basic code to create a property in your class def. I have it bound to `prop` but you can bind it to what you think is most appropriate:
def ${prop}(): #@NoSelf
doc = """${Docstring}"""
def fget(self):
return self._${prop}
def fset(self, value):
self._${prop} = value
def fdel(self):
del(self._${prop})
return locals()
${prop} = property(**${prop}())${cursor}
Enjoy,
-steve
Hmm, code formatting doesn't work. Let's try that again with the leading (...)'s being spaces:
def ${prop}(): #@NoSelf
....doc = """${Docstring}"""
....def fget(self):
........return self._${prop}
....def fset(self, value):
........self._${prop} = value
....def fdel(self):
........del(self._${prop})
....return locals()
${prop} = property(**${prop}())${cursor}
Thanks for the template... I'll add it to the default templates.
Cheers,
Fabio