Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Prevent 0 from being used to construct the identity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Scrimshaw committed Nov 7, 2014
1 parent 9121d13 commit c65cb5e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sage/groups/free_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,11 +811,19 @@ def _element_constructor_(self, *args, **kwds):
sage: F = FreeGroup(0)
sage: F([])
1
Check that 0 isn't considered the identity::
sage: F = FreeGroup('x')
sage: F(0)
Traceback (most recent call last):
...
TypeError: 'sage.rings.integer.Integer' object is not iterable
"""
if len(args)!=1:
return self.element_class(self, *args, **kwds)
x = args[0]
if x==1 or not x:
if x==1 or (not x and x != 0):
return self.one()
try:
P = x.parent()
Expand Down

0 comments on commit c65cb5e

Please sign in to comment.