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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:53:30+00:00 2026-06-09T13:53:30+00:00

Thanks in advance for any help, I know this is probably a newb question

  • 0

Thanks in advance for any help, I know this is probably a newb question but I just can’t find anything via search that seems to answer my question. This is the relevant part of the traceback:

  File "war.py", line 183, in __battle
    if (card1 > card2):
  File "war.py", line 24, in __lt__
    return self.int_id % 13 < other.int_id % 13
AttributeError: 'function' object has no attribute 'int_id'

I’m confused about what this means….what is the ‘function’ object? Also, why is calling lt from a line that’s doing a greater than comparison? Why is this a problem now, given that I unit tested my Card class (of which card1 and card2 are instances of), including all rich comparison operators, and it passed?

These are the definition of the rich comparison methods in my Card class (int_id is, as you would probably guess, just an instance variable int):

(sorry the indenting below got messed up)

class Card():

    def __init__(self, int_id):
        self.int_id = int_id

    def __lt__(self, other):
        return self.int_id % 13 < other.int_id % 13

    def __le__(self, other):
        return self.int_id % 13 <= other.int_id % 13

    def __eq__(self, other):
        return self.int_id % 13 == other.int_id % 13

    def __ne__(self, other):
        return self.int_id % 13 != other.int_id % 13

    def __gt__(self, other):
        return self.int_id % 13 > other.int_id % 13

    def __ge__(self, other):
        return self.int_id % 13 >= other.int_id % 13
  • 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-09T13:53:32+00:00Added an answer on June 9, 2026 at 1:53 pm

    From the error 'function' object has no attribute 'int_id', I would guess that a function object is being compared against a Card in the line if (card1 > card2):. This might occur if one of the cards was mistakenly assigned as a function. For example, card1 = getMyOtherCard instead of card1 = getMyOtherCard().

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

Sidebar

Related Questions

Thanks in advance for any help you can provide on this issue! I manage
Thanks for any help in advance, I can't wrap my SQL skills around this
This question is almost embarrassing to ask, but I can't find the answer in
I know this has probably been answered before, but I cannot find much information
Thanks in advance for any-help with this, I'll try and explain it well. I
This is probably quite a simple question, but I can't remember how to do
Thanks for viewing my question and thanks in advance for any help you may
I am using c# .net. Thanks in advance for any help. I have searched
i have very serious problem if any tech expert can help...thank you in advance..
Please forgive the newb question, but I am not finding answers elsewhere... probably because

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.