diff babel/plural.py @ 579:99d51589c822 trunk

use decorators (as we require Python 2.4+ anyway)
author fschwarz
date Tue, 31 Jul 2012 08:46:19 +0000
parents ca203b2af83c
children
line wrap: on
line diff
--- a/babel/plural.py
+++ b/babel/plural.py
@@ -73,6 +73,7 @@
                        if tag in rules])
         )
 
+    @classmethod
     def parse(cls, rules):
         """Create a `PluralRule` instance for the given rules.  If the rules
         are a `PluralRule` object, that object is returned.
@@ -84,8 +85,8 @@
         if isinstance(rules, cls):
             return rules
         return cls(rules)
-    parse = classmethod(parse)
 
+    @property
     def rules(self):
         """The `PluralRule` as a dict of unicode plural rules.
         
@@ -95,7 +96,6 @@
         """
         _compile = _UnicodeCompiler().compile
         return dict([(tag, _compile(ast)) for tag, ast in self.abstract])
-    rules = property(rules, doc=rules.__doc__)
 
     tags = property(lambda x: frozenset([i[0] for i in x.abstract]), doc="""
         A set of explicitly defined tags in this rule.  The implicit default
Copyright (C) 2012-2017 Edgewall Software