Skip to content

Commit 1648b3a

Browse files
sedruballpil
authored andcommitted
Replace ancient form of python props
1 parent 89ff074 commit 1648b3a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

snippets/python.snippets

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,15 @@ snippet adefm
8585

8686
# New Property
8787
snippet property
88-
def ${1:foo}():
89-
doc = "${2:The $1 property.}"
90-
def fget(self):
91-
${3:return self._$1}
92-
def fset(self, value):
93-
${4:self._$1 = value}
94-
def fdel(self):
95-
${0:del self._$1}
96-
return locals()
97-
$1 = property(**$1())
88+
@property
89+
def ${1:foo}(self) -> ${2:type}:
90+
"""${3:doc}"""
91+
return self._${1:foo}
92+
93+
@${1:foo}.setter
94+
def ${1:foo}(self, value: ${2:type}):
95+
self._${1:foo} = value
96+
9897
# Ifs
9998
snippet if
10099
if ${1:condition}:

0 commit comments

Comments
 (0)