#14790: Python generator for free group variable names
----------------------------------+-----------------------------------------
Reporter: dshurbert | Owner: joyner
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-5.11
Component: group theory | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Davis Shurbert | Merged in:
Dependencies: | Stopgaps:
----------------------------------+-----------------------------------------
Comment (by rbeezer):
1.
{{{
Utility method to create generator for free group variable names,
for use when creating free groups of dynamic size.
}}}
"generator" has two meanings here (and I confused the two). Better:
{{{
Return a generator object that produces names suitable for the
generators of a free group.
}}}
2. And, {{{flag}}} as a keyword name is totally uninformative. Use
something with some meaning. Help the reader. I'd suggest
{{{zeros=False}}}.
3. {{{seed}}} is not a seed. It is a counter. Call it {{{count}}} or
{{{i}}} or something else.
4. Do you really need to import "string" and use the {{{lowercase}}}
array? The usual idiom is:
{{{
chr(ord('a') + ind)
}}}
I guess this one is a toss-up.
5. {{{while (True):}}} does not need parentheses.
6. Include an EXAMPLE doctest that shows a higher iteration through the
alphabet, maybe show
{{{
ls = [test.next() for i in range(3*26)]
ls[2*26:3*26]
}}}
You can break the long list of output in the middle at whitespace and the
test will succeed.
7. The doctest in the TESTS section is great as is, though you could put
both outputs on one line:
{{{
ls[234], ls[260]
}}}
and get a pair as the output. Just more concise.
8. Changing {{{flag}}} inside your if/else on {{{flag}}} is very
confusing. How about
{{{
if mwrap == 0 and not(zeros):
name=''
else:
name = str(mwrap)
}}}
and you can drop the line initializing {{{name}}}.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14790#comment:5>
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.