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 7715879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:29:51+00:00 2026-06-01T02:29:51+00:00

I have the following class: class Enum(RootFragment): def __init__(self, column, packageName, name, modifiers=[public], enumValues=[]):

  • 0

I have the following class:

class Enum(RootFragment):

    def __init__(self, column, packageName, name, modifiers=["public"], enumValues=[]):
        RootFragment.__init__(self, packageName, name, modifiers, "enum")

        self.column = column
        self.enumValues = []

        map(self.addEnumValue, enumValues)

    ... more methods

Now I create a number of Enum instances that are put into a dict. This is what gets printed on print collidingEnums:

{'ManagerRole': <Enum instance at 0x0998F080>, 'StaffMemberRole': <Enum instance at 0x0998B490>}

Now because the <Enum instance at 0x0998F080> is not very useful I’d like to call the getName method on each instance. I was trying:

print ", ".join(map(Enum.getName, collidingEnums.items())),

but this gave me an error saying:

TypeError: unbound method getName() must be called with Enum instance as first argument (got tuple instance instead)

Eeh? How do you call the getName method here? Is it possible that way at all?

  • 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-06-01T02:29:52+00:00Added an answer on June 1, 2026 at 2:29 am

    Don’t use map. Use a generator expression instead:

    print ", ".join(i.getName() for i in collidingEnums.values())
    

    Alternatively, you could simply define your own __repr__ method for your Enum class, which is what Python uses to determine what you print out if you just try to print the class.

    class Enum(RootFrament):
    
        # ...
    
        def __repr__(self):
            return self.getName()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following class public class Car { public Name {get; set;} }
I have the following code in C++: class Person { public: enum Gender {Male,
I have the following code: class EmployeeFactory { public enum EmployeeType { ManagerType, ProgrammerType,
I have an enum class like the following: public enum Letter { OMEGA_LETTER(Omega), GAMMA_LETTER(Gamma),
I have the following enum in a Java class: public enum Resolution { RES_32
I have the following enum and POCO class public enum Gender { Male, Female,
So, say I have the following enum declaration: public class WatchService implements Runnable {
I have following entity class User: public class User implements Serializable { @Column(length =
I have a problem with the following code: class SymmetryTypes { public: enum Type
greetings. i have the following class: public class Ship { public enum ValidShips {

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.