Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6966563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:12:29+00:00 2026-05-27T16:12:29+00:00

Using Python 3, I unpackaged the flufl.enum code into my application source tree just

  • 0

Using Python 3, I unpackaged the flufl.enum code into my application source tree just to try it. Sample code:

from taurine.flufl.enum import Enum

class Colors(Enum):
    red = 1
    green = 2
    blue = 3

print(Colors.red)
red = Colors.red
print("red == Colors.red "+str(red == Colors.red))
print("red == Colors.blue "+str(red == Colors.blue))
print("red is Colors.red "+str(red is Colors.red))

Everything works as expected except the print(Color.red). According to http://packages.python.org/flufl.enum/docs/using.html I’d expect it to print “Colors.red” but it’s printing 1. Anyone familiar with this package know if there’s a way to get it to print “Colors.red”? I’ve posted a question on the library’s site but thought someone here might have experience as well.

EDIT: It does work as expected if I define Colors with:

Colors = make_enum('Colors','red green blue')

But I prefer the syntax of:

class Colors(Enum):
    red = 1
    green = 2
    blue = 3
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:12:30+00:00Added an answer on May 27, 2026 at 4:12 pm

    I realized init wasn’t even being called on EnumMetaclass. I think the following code in _enum.py is meant to make inheriting from Enum all you’d need to do, but something about it doesn’t work and it’s beyond me:

    class Enum:
        __metaclass__ = EnumMetaclass
    

    This works:

    class Colors(metaclass=EnumMetaclass):
        red = 1
        green = 2
        blue = 3
    

    I’m happy now.

    EDIT: Found out why. See the first answer to the following question: Shouldn't __metaclass__ force the use of a metaclass in Python?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Python, how would I go about reading in (be from a string, file
Using python and wsgiref.handlers, I can get a single variable from a form with
I am using Python and BeautifulSoup to extract financial statement information from cities financial
Using Python 2.5.2 and Linux Debian, I'm trying to get the content from a
When using Python and doing a Select statement to MYSQL to select 09 from
I'm using Python and its MySQLdb module to import some measurement data into a
Using Python v2, I have the user entering an amount into a string as
Using Python v2, I have the following code: print (Total of the sale is:
Using python 2.6.5, I can use the with statement without calling from __future__ import
Using Python I can test my code in the terminal / command line by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.