exporting patch:
# HG changeset patch
# User Julian Rueth <julian.rueth@gmail.com>
Trac 9054: use cached_method decorator
diff git a/sage/rings/function_field/function_field.py b/sage/rings/function_field/function_field.py
index 78d0807..f894165 100644
a

b

from sage.structure.parent_gens import ParentWithGens 
59  59  from sage.structure.parent import Parent 
60  60  import function_field_element 
61  61  import constructor 
 62  
 63  from sage.misc.cachefunc import cached_method 
 64  
62  65  from sage.categories.function_fields import FunctionFields 
63  66  CAT = FunctionFields() 
64  67  
… 
… 
class FunctionField_polymod(FunctionField): 
718  721  """ 
719  722  return self._ring 
720  723  
 724  @cached_method 
721  725  def vector_space(self): 
722  726  """ 
723  727  Return a vector space V and isomorphisms self > V and V > self. 
… 
… 
class FunctionField_polymod(FunctionField): 
793  797  To: Vector space of dimension 2 over Function field in w defined by y^5  2*x*y + (x^4  1)/x) 
794  798  
795  799  """ 
796   try: return self._vector_space 
797   except AttributeError: 
798   V = self.base_field()**self.degree() 
799   from_V = maps.MapVectorSpaceToFunctionField(V, self) 
800   to_V = maps.MapFunctionFieldToVectorSpace(self, V) 
801   self._vector_space = (V, from_V, to_V) 
802   return self._vector_space 
 800  V = self.base_field()**self.degree() 
 801  from maps import MapVectorSpaceToFunctionField, MapFunctionFieldToVectorSpace 
 802  from_V = MapVectorSpaceToFunctionField(V, self) 
 803  to_V = MapFunctionFieldToVectorSpace(self, V) 
 804  self._vector_space = (V, from_V, to_V) 
 805  return self._vector_space 
803  806  
804  807  
805  808  def maximal_order(self): 
… 
… 
class RationalFunctionField(FunctionField): 
1149  1152  from sage.structure.factorization import Factorization 
1150  1153  return Factorization(w, unit=unit) 
1151  1154  
 1155  @cached_method 
1152  1156  def polynomial_ring(self, var='x'): 
1153  1157  """ 
1154  1158  Return polynomial ring K[var] that could be used to represent 
… 
… 
class RationalFunctionField(FunctionField): 
1190  1194  To: Vector space of dimension 1 over Rational function field in x over Rational Field) 
1191  1195  
1192  1196  """ 
1193   try: return self._vector_space 
1194   except AttributeError: 
1195   V = self.base_field()**1 
1196   from_V = maps.MapVectorSpaceToFunctionField(V, self) 
1197   to_V = maps.MapFunctionFieldToVectorSpace(self, V) 
1198   self._vector_space = (V, from_V, to_V) 
1199   return self._vector_space 
 1197  V = self.base_field()**1 
 1198  from maps import MapVectorSpaceToFunctionField, MapFunctionFieldToVectorSpace 
 1199  from_V = MapVectorSpaceToFunctionField(V, self) 
 1200  to_V = MapFunctionFieldToVectorSpace(self, V) 
 1201  self._vector_space = (V, from_V, to_V) 
 1202  return self._vector_space 
1200  1203  
1201  1204  def random_element(self, *args, **kwds): 
1202  1205  """ 
… 
… 
class RationalFunctionField(FunctionField): 
1330  1333  """ 
1331  1334  return self._field 
1332  1335  
 1336  @cached_method 
1333  1337  def maximal_order(self): 
1334  1338  """ 
1335  1339  Return the maximal order of this function field. Since this 
… 
… 
class RationalFunctionField(FunctionField): 
1345  1349  Maximal order in Rational function field in t over Rational Field 
1346  1350  
1347  1351  """ 
1348   try: return self._maximal_order 
1349   except AttributeError: 
1350   from function_field_order import FunctionFieldOrder_rational 
1351   self._maximal_order = FunctionFieldOrder_rational(self) 
1352   return self._maximal_order 
 1352  from function_field_order import FunctionFieldOrder_rational 
 1353  return FunctionFieldOrder_rational(self) 
1353  1354  
1354  1355  equation_order = maximal_order 
1355  1356  