# HG changeset patch
# User Franco Saliola <saliola@gmail.com>
# Date 1245612237 -7200
# Node ID eed995d18b83b53bb8a3910c65d00d41bf38ad0d
# Parent  3ead28f72457a47a670c07c207b330e1c72b2359
[mq]: trac_5790-review.patch

diff -r 3ead28f72457 -r eed995d18b83 sage/combinat/partition.py
--- a/sage/combinat/partition.py	Mon Jun 15 15:31:27 2009 -0400
+++ b/sage/combinat/partition.py	Sun Jun 21 21:23:57 2009 +0200
@@ -284,31 +284,36 @@
     elif 'beta_numbers' in key_word and len(key_word)==1:
         raise NotImplementedError
     elif 'exp' in key_word and len(key_word)==1:
-        return Partition_class([]).from_exp(key_word['exp'])
+        return from_exp(key_word['exp'])
     elif 'core' in key_word and 'quotient' in key_word and len(key_word)==2:
-        return Partition_class([]).from_core_and_quotient(key_word['core'], key_word['quotient'])
+        return from_core_and_quotient(key_word['core'], key_word['quotient'])
     elif 'core' in key_word and 'canonical_quotient' in key_word and len(key_word)==2:
         raise NotImplementedError
     elif 'core_and_quotient' in key_word and len(key_word)==1:
         from sage.misc.misc import deprecation
         deprecation('"core_and_quotient=(*)" is deprecated. Use "core=[*], quotient=[*]" instead.')
-        return Partition_class([]).from_core_and_quotient(*key_word['core_and_quotient'])
+        return from_core_and_quotient(*key_word['core_and_quotient'])
     else:
         raise ValueError, 'incorrect syntax for Partition()'
 
-def from_exp(a):
-    """
-    ** This function is being deprecated - use Partition(exp=*) instead **
+def from_exp(exp):
+    """
     Returns a partition from its list of multiplicities.
+
+    .. note::
+
+       This function is for internal use only; 
+       use Partition(exp=*) instead.
     
     EXAMPLES::
     
         sage: Partition(exp=[1,2,1])
         [3, 2, 2, 1]
     """
-    from sage.misc.misc import deprecation
-    deprecation('"from_exp" is deprecated. Use "Partition(exp=[*])" instead.')
-    return Partition(exp=a)
+    p = []
+    for i in reversed(range(len(exp))):
+        p += [i+1]*exp[i]
+    return Partition(p)
 
 def from_core_and_quotient(core, quotient):
     """
@@ -318,54 +323,29 @@
     
     Algorithm from mupad-combinat.
     
+    .. note::
+
+       This function is for internal use only; 
+       use Partition(core=*, quotient=*) instead.
+    
     EXAMPLES::
     
         sage: Partition(core=[2,1], quotient=[[2,1],[3],[1,1,1]])
         [11, 5, 5, 3, 2, 2, 2]
     """
-    from sage.misc.misc import deprecation
-    deprecation('"from_core_and_quotient" is deprecated. Use "Partition(core=[*],quotient=[*])" instead.')
-    return Partition(core=core,quotient=quotient)
-    
+    length = len(quotient)
+    k = length*max( [ceil(len(core)/length),len(core)] + [len(q) for q in quotient] ) + length
+    v = [ core[i]-(i+1)+1 for i in range(len(core))] + [ -i + 1 for i in range(len(core)+1,k+1) ]
+    w = [ filter(lambda x: (x-i) % length == 0, v) for i in range(1, length+1) ]
+    new_w = []
+    for i in range(length):
+        new_w += [ w[i][j] + length*quotient[i][j] for j in range(len(quotient[i]))]
+        new_w += [ w[i][j] for j in range(len(quotient[i]), len(w[i])) ]
+    new_w.sort()
+    new_w.reverse()
+    return Partition([new_w[i-1]+i-1 for i in range(1, len(new_w)+1)])
+
 class Partition_class(CombinatorialObject):
-    def from_exp(self,exp):
-        """
-        Returns a partition from its list of multiplicities.
-        
-        EXAMPLES::
-        
-            sage: Partition(exp=[1,2,1])
-            [3, 2, 2, 1]
-        """
-        p = []
-        for i in reversed(range(len(exp))):
-            p += [i+1]*exp[i]
-        return Partition(p)
-
-    def from_core_and_quotient(self, core, quotient):
-        """
-        Returns a partition from its core and quotient.
-        
-        Algorithm from mupad-combinat.
-        
-        EXAMPLES::
-        
-            sage: Partition(core=[2,1], quotient=[[2,1],[3],[1,1,1]])
-            [11, 5, 5, 3, 2, 2, 2]
-        """
-        length = len(quotient)
-        k = length*max( [ceil(len(core)/length),len(core)] + [len(q) for q in quotient] ) + length
-        v = [ core[i]-(i+1)+1 for i in range(len(core))] + [ -i + 1 for i in range(len(core)+1,k+1) ]
-        w = [ filter(lambda x: (x-i) % length == 0, v) for i in range(1, length+1) ]
-        new_w = []
-        for i in range(length):
-            new_w += [ w[i][j] + length*quotient[i][j] for j in range(len(quotient[i]))]
-            new_w += [ w[i][j] for j in range(len(quotient[i]), len(w[i])) ]
-        new_w.sort()
-        new_w.reverse()
-        return Partition([new_w[i-1]+i-1 for i in range(1, len(new_w)+1)])
-
-
     def ferrers_diagram(self):
         """
         Return the Ferrers diagram of pi.
