#15567: Fix Alphabet and improvements to Family
-------------------------------------+-------------------------------------
       Reporter:  tscrim             |        Owner:  sage-combinat
           Type:  defect             |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.1
      Component:  combinatorics      |   Resolution:
       Keywords:  alphabet           |    Merged in:
        Authors:  Travis Scrimshaw   |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  public/combinat/words/fix_alphabet |  b3396dd62e96a08621cf08a6b2573c59a664adac
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by tscrim):

 Replying to [comment:2 ncohen]:
 > Hello !
 >
 > I don't know how this "names" argument is used at all, but its current
 behaviour is the following :
 >
 > {{{
 > sage: build_alphabet(oo,'x')[4]
 > 'x4'
 > sage: build_alphabet(range(40),'x')[4]
 > 4
 > }}}
 >
 > Which is not very consistent.

 This is also inconsistent input types (one is a "number", the other is a
 set). However the other could raise an error as invalid input as opposed
 to being silently ignored.

 > While playing with it I found something else which totally scares me :
 >
 > {{{
 > sage: build_alphabet(oo,'x')
 > Lazy family (x(i))_{i in Non negative integers}
 > sage: build_alphabet(oo,'x')[:4]
 > 'xslice(None, 4, None)'
 > sage: print list(build_alphabet(oo,'x')[:4])
 > ['x', 's', 'l', 'i', 'c', 'e', '(', 'N', 'o', 'n', 'e', ',', ' ', '4',
 ',', ' ', 'N', 'o', 'n', 'e', ')']
 > }}}
 >
 > While I expected to get the list of the first 4 elements. And I really
 do not know what to make with that `O_o`

 This is an issue with `Family` in that it is directly passing a string
 representation of the input of `__getitem__()` without any safety checks
 (for speed). It's outside the scope of what I want to do in this ticket
 and has a landmine of "you've picked a specific ordering of the indices
 that may not be canonical".

 > Anyway, I think that the `build_alphabet` function could use a "INPUT"
 section explaining its parameters, and in particular the "names" field.
 Which, in the context of `build_alphabet(oo,'x')` would be better renamed
 to "prefix", as it adds this string to all members of the family.

 I'll add it. Since "names" not (really) used anywhere else, I'll change
 it.

 > About the modifications to `Family` :
 > * would it be possible to add to the documentation of "hidden_keys" an
 explanation of what exactly it does ? Does it mean that the hidden keys
 are "skipped", i.e. removed from "indices" ?

 It means they are valid keys (indices) of the Family that are hidden.

 > * the explanation of what `hidden_function` is isn't very clear either
 `O_o`

 Then neither should be the one for `function` (or does it make sense if I
 change the `a` to a `the` in `hidden_function`?).

 > The fact that the "name" argument does nothing for finite lists should
 be made clear I guess. I mean, what is it useful for exactly?

 So lazy familys display nicely (espically when using lambda functions).

--
Ticket URL: <http://trac.sagemath.org/ticket/15567#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to