@@ -2783,12 +2783,13 @@ class so far, an alias named ``get_alias`` will be defined; the same will
2783
2783
exception will be raised.
2784
2784
2785
2785
The alias map is stored as the ``_alias_map`` attribute on the class and
2786
- can be used by `~.normalize_kwargs`.
2786
+ can be used by `~.normalize_kwargs` (which assumes that higher priority
2787
+ aliases come last).
2787
2788
"""
2788
2789
if cls is None :
2789
2790
return functools .partial (_define_aliases ,alias_d )
2790
2791
2791
- def make_alias (name ):#Enfore a closure over *name*.
2792
+ def make_alias (name ):#Enforce a closure over *name*.
2792
2793
def method (self ,* args ,** kwargs ):
2793
2794
return getattr (self ,name )(* args ,** kwargs )
2794
2795
return method
@@ -2804,7 +2805,11 @@ def method(self, *args, **kwargs):
2804
2805
method .__doc__ = "alias for `{}`" .format (prefix + prop )
2805
2806
setattr (cls ,prefix + alias ,method )
2806
2807
if not exists :
2807
- raise ValueError ("property {} does not exist" .format (prop ))
2808
+ raise ValueError (
2809
+ "Neither getter nor setter exists for {!r}" .format (prop ))
2808
2810
2811
+ if hasattr (cls ,"_alias_map" ):
2812
+ # Need to decide on conflict resolution policy.
2813
+ raise NotImplementedError ("Parent class already defines aliases" )
2809
2814
cls ._alias_map = alias_d
2810
2815
return cls