Convenience API illegal identifiers should raise SyntaxError - maybe
Bug #1167054 reported by
Barry Warsaw
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
flufl.enum |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Class syntax with invalid identifiers raises a SyntaxError:
class X(Enum):
a-1 = 3
but the convenience API raises a ValueError. This latter should also raise SyntaxError for consistency.
OTOH, should we be consistent with namedtuples?
http://
>>> namedtuple('X', ('x-1', 'y-2'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/py33/
'identifiers: %r' % name)
ValueError: Type names and field names must be valid identifiers: 'x-1'
summary: |
- Convenience API illegal identifiers should raise SyntaxError + Convenience API illegal identifiers should raise SyntaxError - maybe |
To post a comment you must log in.
After further consideration, it makes sense to be consistent with namedtuples, so ValueError it will be for now.