make_enum doesn't enforce "valid Python identifiers" limitation

Bug #803570 reported by ssteinerX
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
flufl.enum
Fix Released
Low
Barry Warsaw

Bug Description

>>> Foo = flufl.enum.make_enum("Foo", "ham spam eggs" )
>>> Foo.ham
<EnumValue: Foo.ham [int=1]>
>>> Doo = flufl.enum.make_enum("Foo", "1 2 3")
>>> Doo
<Foo {1: 1, 2: 2, 3: 3}>
>>> Doo.1
  File "<stdin>", line 1
    Doo.1
        ^
SyntaxError: invalid syntax
>>> Doo(1)
<EnumValue: Foo.1 [int=1]>

Not sure whether this is worth dealing with, more of an observation.

Revision history for this message
Barry Warsaw (barry) wrote :

Yeah, probably worth fixing, low priority though. :)

Changed in flufl.enum:
status: New → Confirmed
importance: Undecided → Low
Barry Warsaw (barry)
Changed in flufl.enum:
milestone: none → 3.2
status: Confirmed → Fix Committed
assignee: nobody → Barry Warsaw (barry)
Barry Warsaw (barry)
Changed in flufl.enum:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.