Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add explicit `name` to `memoized_property` #31

Merged
merged 1 commit into from

2 participants

@wolever

Can be useful if the "func" is actually a class to be used as some sort of manager, or similar.

@wolever wolever Add explicit `name` to `memoized_property`
Can be useful if the "func" is actually a class to be used as some sort of manager, or similar.
311ddb2
@shazow shazow merged commit 4a44ca4 into shazow:master

1 check passed

Details default The Travis CI build passed
@wolever wolever deleted the wolever:patch-3 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 27, 2014
  1. @wolever

    Add explicit `name` to `memoized_property`

    wolever authored
    Can be useful if the "func" is actually a class to be used as some sort of manager, or similar.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 unstdlib/standard/functools_.py
View
4 unstdlib/standard/functools_.py
@@ -113,10 +113,10 @@ def decorator(fn):
# https://twitter.com/zzzeek/status/310503354268790784
class memoized_property(object):
""" A read-only @property that is only evaluated once. """
- def __init__(self, fget, doc=None):
+ def __init__(self, fget, doc=None, name=None):
self.fget = fget
self.__doc__ = doc or fget.__doc__
- self.__name__ = fget.__name__
+ self.__name__ = name or fget.__name__
def __get__(self, obj, cls):
if obj is None:
Something went wrong with that request. Please try again.