Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P32
property decorator
Archived
Public
Actions
Authored by
nisstyre56
on Jul 25 2017, 3:10 PM.
Edit Paste
Activate Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Tags
None
Subscribers
None
Tokens
"Like" token, awarded by jcmcdonald.
# original
def
get_tries
(
self
):
"""
Return the number of remaining tries.
"""
return
self
.
settings
.
tries
-
self
.
_try
# with properties
@property
def
tries
(
self
):
"""
Return the number of remaining tries.
"""
return
self
.
settings
.
tries
-
self
.
_try
# you would do foo.tries which is equivalent to foo.tries()
Event Timeline
nisstyre56
created this paste.
Jul 25 2017, 3:10 PM
2017-07-25 15:10:29 (UTC-7)
jcmcdonald
awarded a token.
Jul 25 2017, 3:11 PM
2017-07-25 15:11:00 (UTC-7)
jcmcdonald
updated the paste's language from
autodetect
to
python
.
Dec 7 2017, 4:46 PM
2017-12-07 16:46:28 (UTC-8)
jcmcdonald
archived this paste.
Jan 11 2020, 3:19 PM
2020-01-11 15:19:19 (UTC-8)
Log In to Comment