Ticket #5538: family_review.patch

File family_review.patch, 2.6 KB (added by nthiery, 13 years ago)
  • sage/sets/family.py

    # HG changeset patch
    # User Nicolas M. Thiery <nthiery@users.sf.net>
    # Date 1239732065 -7200
    # Node ID 3cd809d66358f12bfddabe140245a5163efed1a0
    # Parent  8d85f041afa3c53468f4294f13595c4e3c91d9a0
    
    Final review for Family #5538
    
    diff -r 8d85f041afa3 -r 3cd809d66358 sage/sets/family.py
    a b  
    2121from sage.rings.integer import Integer
    2222from sage.misc.misc import AttrCallObject
    2323from warnings import warn
    24 name_warn_message = "The keyword name for family has never been used and will be removed shortly. Please update your code."
     24name_warn_message = "The keyword argument `name` for Family has never been implemented and will be removed shortly.\nPlease update your code to use f=Family(...); f.rename(...)."
    2525 
    2626def Family(indices, function = None, hidden_keys = [], hidden_function = None, lazy = False, name=None):
    2727    r"""
     
    157157       sage: f == loads(dumps(f))
    158158       True
    159159
    160     But this one don't::   
     160    But this one does not::   
    161161
    162162       sage: def plus_n(n): return lambda x: x+n
    163163       sage: f = Family([1,2,3], plus_n(3), lazy=True); f
     
    280280
    281281        sage: f = Family({1:'a', 2:'b', 3:'c'}, lazy=True)
    282282        Traceback (most recent call last):
    283         ValueError: lazy keyword only makes sense together with function keyword !
     283        ValueError: `lazy` keyword parameter only makes sense together with `function` keyword parameter
    284284       
    285285    ::
    286286   
     
    320320
    321321    if hidden_keys == []:
    322322        if hidden_function is not None:
    323                 raise ValueError, "hidden_function keyword only makes sense together with hidden_keys keyword !"           
     323                raise ValueError, "`hidden_function` keyword parameter only makes sense together with `hidden_keys` keyword parameter"           
    324324        elif function is None:
    325325            if lazy:
    326                 raise ValueError, "lazy keyword only makes sense together with function keyword !"
     326                raise ValueError, "`lazy` keyword parameter only makes sense together with `function` keyword parameter"
    327327            if isinstance(indices, dict):
    328328                return FiniteFamily(indices)
    329329            if isinstance(indices, (list, tuple) ):
     
    339339            return LazyFamily(indices, function)           
    340340    else:
    341341        if lazy:
    342             raise ValueError, "lazy keyword is incompatible with hidden keys !"
     342            raise ValueError, "`lazy` and `hidden_keys` keyword parameters are mutually exclusive"
    343343        if hidden_function is None:
    344344            hidden_function = function
    345345        return FiniteFamilyWithHiddenKeys(dict([(i, function(i)) for i in indices]),