#15006: Unclear example in the tutorial
-------------------------------------+-------------------------------------
       Reporter:  mmezzarobba        |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  minor              |    Milestone:  sage-6.3
      Component:  documentation      |   Resolution:
       Keywords:  tutorial           |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/sanvila/unclear_example_in_the_tutorial|  
3bbb6aa757d0fe064de7b6667aaeaa4b1c4248bb
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vbraun):

 In fact, the order is fixed in the example (otherwise the doctest would
 occasionally fail). But it is only fixed in this case coincidentally
 (CPython hash table implementation detail and consecutive hashes for Sage
 integers).

 Perhaps a better example
 {{{
 sage: d = dict([(chr(i+97), i) for i in range(26)])
 sage: d   # note: our displayhook sorts output by keys!
 {'a': 0,
  'b': 1,
  'c': 2,
  'd': 3,
  'e': 4,
  'f': 5,
  'g': 6,
  'h': 7,
  'i': 8,
  'j': 9,
  'k': 10,
  'l': 11,
  'm': 12,
  'n': 13,
  'o': 14,
  'p': 15,
  'q': 16,
  'r': 17,
  's': 18,
  't': 19,
  'u': 20,
  'v': 21,
  'w': 22,
  'x': 23,
  'y': 24,
  'z': 25}
 sage: d.keys()     # random order
 ['a',
  'c',
  'b',
  'e',
  'd',
  'g',
  'f',
  'i',
  'h',
  'k',
  'j',
  'm',
  'l',
  'o',
  'n',
  'q',
  'p',
  's',
  'r',
  'u',
  't',
  'w',
  'v',
  'y',
  'x',
  'z']
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15006#comment:7>
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/d/optout.

Reply via email to