-2

This question of mine was unilaterally marked as a duplicate of this question by a gold badge holder almost immediately after I asked it. However, all of the answers in the question that it was marked a duplicate of involved using a metaclass to apply magic methods to the class itself, which I specifically said didn't work in my case (using metaclasses would involve inheriting from type and Exception, which raises a TypeError).

I had already read that question and its answers before I asked, and I had made a point of mentioning how it didn't work.

Edit: Someone suggested that this is a possible duplicate of "This question may already have an answer here" - but it does not - however, that question is asking why there is a possible duplicate header; I am asking why my question was completely marked as a duplicate.

Why was my question marked as a duplicate?

4
  • It was closed by a single user, who has a gold badge in the Python tag. Gold tag badge holders can single-handedly close as duplicates. Commented Aug 30, 2018 at 6:35
  • 2
    @S.L.Barth I am aware of that; I am mostly bringing this up because I don't believe that the question was a duplicate, but am willing to accept reasoning as to why it in fact was (if it really is a duplicate and should remain such).
    – AbyxDev
    Commented Aug 30, 2018 at 6:46
  • 2
    I have notified the gold badged user of this meta. They expressed appreciation. With a little luck there will be more insight soon.
    – Yunnosch
    Commented Aug 30, 2018 at 6:50
  • If you do not believe it is a duplicate, the proper course of action would be to edit your original question and explain there why it is not.
    – yivi
    Commented Aug 30, 2018 at 7:04

1 Answer 1

12

Disclaimer: I'm the user who marked the question as duplicate.

I marked your question as duplicate of __getattr__ for static/class variables in python because both questions want to achieve the same thing - dynamic attributes on a class. All answers in that question will show you how to solve your problem, so it is a duplicate.

You say that those answers don't solve your problem:

However, all of the answers in the question that it was marked a duplicate of involved using a metaclass to apply magic methods to the class itself, which I specifically said didn't work in my case (using metaclasses would involve inheriting from type and Exception, which raises a TypeError).

But the reason for this is very simple: It's not that the answers don't work, it's that you aren't using the metaclass correctly. If you change your class definition from class APIError(Exception, meta): to class APIError(Exception, metaclass=meta):, the TypeError will go away.

I suppose I should've left a comment on your question to tell you about this mistake, but I thought you'd end up with correct code anyway if you apply the answers from the duplicate to your problem. That was an oversight on my part. I will leave a comment explaining how to use the metaclass correctly after I finish writing this meta post.


So, to summarize: The answers in the duplicate solve your problem, as long as you apply them correctly.


(P.S.: In the future, please contact the gold badge user who closed your question directly before making a meta post. Just leave a comment with a ping to @Aran-Fey under your question and I'll respond as soon as I'm able. It's far more efficient than posting a meta question.)

1
  • 1
    Ah, thank you for the clarification! I didn't realize I was applying that question's methods wrong.
    – AbyxDev
    Commented Aug 30, 2018 at 7:54

Not the answer you're looking for? Browse other questions tagged .