#8197: Documenting check=True/False parameters
----------------------------------+-----------------------------------------
   Reporter:  cremona             |       Owner:  AlexGhitza
       Type:  defect              |      Status:  new       
   Priority:  major               |   Milestone:  sage-4.3.3
  Component:  algebraic geometry  |    Keywords:            
     Author:                      |    Upstream:  N/A       
   Reviewer:                      |      Merged:            
Work_issues:                      |  
----------------------------------+-----------------------------------------

Comment(by fwclarke):

 Replying to [ticket:8197 cremona]:

 > The point is that on creation of the point, valid tuple input is
 converted to a list, unless check=False in which case tuples are left as
 tuples.

 John, it's not quite accurate what you say:

 {{{
 sage: P2 = ProjectiveSpace(GF(2),2)
 sage: type(P2.point([0,0,1])._coords)
 <class 'sage.structure.sequence.Sequence'>
 sage: type(P2.point([0,0,1], check=False)._coords)
 <type 'list'>
 }}}
 even though

 {{{
 sage: P2.point([0,0,1], check=False) == P2.point([0,0,1])
 True
 }}}
 The relevant code is for the class
 `SchemeMorphism_projective_coordinates_field` in
 `schemes/generic/morphism.py :` with `check=False,` absolutely nothing is
 done except for setting the attribute `_coords`.  Thus

 {{{
 sage: P = P2.point("Anything", check=False)
 sage: P._coords
 'Anything'
 sage: P
 ('A' : 'n' : 'y' : 't' : 'h' : 'i' : 'n' : 'g')
 }}}
 So, strictly speaking, the coordinates have to be given as a `Sequence` of
 the right length.

 I think you're right that the key thing is documentation.  In each case
 there's a design balance to be drawn (when `check=False`) between on the
 one hand checking nothing at all and on the other making some basic
 conversions, while not doing time-consuming things such as, for example,
 verifying that an input satisfies a polynomial.  How this balance is drawn
 will vary, but the INPUT block ought make it clear how the requirements
 depend on the value of `check`.

 The relevant part of the documentation for
 `SchemeMorphism_projective_coordinates_field` says

 {{{
      -  ``v`` - a list or tuple of coordinates in K
 }}}
 The code shows that this is actually too restrictive when `check` is True,
 and it is inaccurate when check is False.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8197#comment:2>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to