Changes between Initial Version and Version 1 of Ticket #18411, comment 38
- Timestamp:
- 09/15/15 22:10:01 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #18411, comment 38
initial v1 8 8 > is automatically filled since it is a lazy_list. 9 9 10 Oh, I had not noticed that, in EnumeratedSetFromIterator, the existence10 Oh, I had not noticed that, in `EnumeratedSetFromIterator`, the existence 11 11 of the cache was decided upon construction. +1 then. 12 12 13 >>>> - Why moving __iter__ from EnumeratedSets.CartesianProductsto14 >>>> Sets.CartesianProducts?13 >>>> - Why moving __iter__ from `EnumeratedSets.CartesianProducts` to 14 >>>> `Sets.CartesianProducts`? 15 15 >>> 16 16 >>> Because otherwise there are some failing doctests. For example 17 >>> Set([1,2,3])17 >>> `Set([1,2,3])` 18 18 >>> is iterable but the following was not 19 >>> cartesian_product([Set(1,2,3), Set([1,2,3])])19 >>> `cartesian_product([Set(1,2,3), Set([1,2,3])])` 20 20 >>> 21 21 >>> The fact that something is iterable does not necessarily mean that it 22 >>> belongs to EnumeratedSet. At least for me and the current class23 >>> FiniteEnumeratedSet, the enumerated set {1, 2, 3} is not equal to the22 >>> belongs to `EnumeratedSet`. At least for me and the current class 23 >>> `FiniteEnumeratedSet`, the enumerated set {1, 2, 3} is not equal to the 24 24 >>> enumerated set {3, 2, 1}. But they are equal as sets. And the set {1, 2, 3} 25 25 >>> should be iterable. 26 26 >> 27 27 >> I see your point. Yet this is annoying; where do we want to put the 28 >> exact limit between Set and EnumeratedSet? Where should, e.g. features28 >> exact limit between `Set` and `EnumeratedSet`? Where should, e.g. features 29 29 >> like cardinality_from_iterator live? 30 30 >> … … 57 57 >done 58 58 > 59 >> - CartesianProduct_iters: Make the difference with cartesian_product59 >> - `CartesianProduct_iters`: Make the difference with cartesian_product 60 60 >> more explicit and add a link? 61 61 > 62 62 >done 63 63 > 64 >> - Compositions: return FiniteEnumeratedSet([self])64 >> - Compositions: `return FiniteEnumeratedSet([self])` 65 65 > 66 66 >done 67 67 > 68 >> or make cartesian_product() return FiniteEnumeratedSet([xxx])or69 >> Set([xxx]) where xxxis the trivial tuple.68 >> or make `cartesian_product()` return `FiniteEnumeratedSet([xxx])` or 69 >> `Set([xxx])` where `xxx` is the trivial tuple. 70 70 > 71 71 >This is not a good idea. The interface should be uniform when you do … … 76 76 >I did not found any. The empty tuple comes from the iteration with product. 77 77 > 78 >> - root_lattice_realization: is the conversion to FiniteEnumeratedSet78 >> - root_lattice_realization: is the conversion to `FiniteEnumeratedSet` 79 79 >> still necessary? 80 80 >> 81 >> {{{ 81 82 >> C = cartesian_product([PositiveIntegers(), 82 83 >> FiniteEnumeratedSet(Q.roots())]) 84 >> }}} 83 85 >> 84 86 >> If so, should instead cartesian_product do more input tidying work? … … 90 92 > >infinity 91 93 > 92 > I reintroduced the test using cartesian_product instead of CartesianProduct94 > I reintroduced the test using `cartesian_product` instead of `CartesianProduct` 93 95 > 94 96 >> ... about `cartesian_product()` ... … … 96 98 >> So what about returning: 97 99 >> 100 >> {{{ 98 101 >> sage: from sage.sets.cartesian_product import CartesianProduct 99 102 >> sage: CartesianProduct((), Sets().CartesianProducts()) 100 103 >> The cartesian product of () 104 >> }}} 101 105 >> 102 106 >> I vaguely remember we discussed this at some point, but don't remember 103 107 >> what the outcome was. Of course if the user did not specify a category 104 >> to cartesian_product(), we don't quite know what's the category he105 >> expects, but Sets().CartesianProducts()sounds like a reasonable108 >> to `cartesian_product()`, we don't quite know what's the category he 109 >> expects, but `Sets().CartesianProducts()` sounds like a reasonable 106 110 >> starting point. 107 111 > … … 109 113 >backward compatibility it needs to be done in that ticket... we had 110 114 > 115 > {{{ 111 116 >sage: CartesianProduct() 112 117 >Cartesian product of … … 115 120 >sage: CartesianProduct().an_element() 116 121 >[] 122 >}}} 117 123 > 118 124 >There is an other commit for that.