# 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
|
|
21 | 21 | from sage.rings.integer import Integer |
22 | 22 | from sage.misc.misc import AttrCallObject |
23 | 23 | from 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." |
| 24 | name_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(...)." |
25 | 25 | |
26 | 26 | def Family(indices, function = None, hidden_keys = [], hidden_function = None, lazy = False, name=None): |
27 | 27 | r""" |
… |
… |
|
157 | 157 | sage: f == loads(dumps(f)) |
158 | 158 | True |
159 | 159 | |
160 | | But this one don't:: |
| 160 | But this one does not:: |
161 | 161 | |
162 | 162 | sage: def plus_n(n): return lambda x: x+n |
163 | 163 | sage: f = Family([1,2,3], plus_n(3), lazy=True); f |
… |
… |
|
280 | 280 | |
281 | 281 | sage: f = Family({1:'a', 2:'b', 3:'c'}, lazy=True) |
282 | 282 | 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 |
284 | 284 | |
285 | 285 | :: |
286 | 286 | |
… |
… |
|
320 | 320 | |
321 | 321 | if hidden_keys == []: |
322 | 322 | 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" |
324 | 324 | elif function is None: |
325 | 325 | 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" |
327 | 327 | if isinstance(indices, dict): |
328 | 328 | return FiniteFamily(indices) |
329 | 329 | if isinstance(indices, (list, tuple) ): |
… |
… |
|
339 | 339 | return LazyFamily(indices, function) |
340 | 340 | else: |
341 | 341 | if lazy: |
342 | | raise ValueError, "lazy keyword is incompatible with hidden keys !" |
| 342 | raise ValueError, "`lazy` and `hidden_keys` keyword parameters are mutually exclusive" |
343 | 343 | if hidden_function is None: |
344 | 344 | hidden_function = function |
345 | 345 | return FiniteFamilyWithHiddenKeys(dict([(i, function(i)) for i in indices]), |