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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:53:26+00:00 2026-05-30T21:53:26+00:00

Is this possible in Python? class MyClass(object): @property def property(self): return self._property That is,

  • 0

Is this possible in Python?

class MyClass(object):
    @property
    def property(self):
        return self._property

That is, I want to have a property named ‘property’. It actually runs fine, but Eclipse complains with a warning. I thought the built-in @property decorator lived in a different namespace than the methods and properties within my classes.

Is it possible to rename the built-in decorator within the scope of the relevant module, so I can use the name ‘property’ without receiving this warning? Maybe something like the following:

attr = property

class MyClass(object):
    @attr
    def property(self):
        return self._property

I do this, but I still get the warning, since I created an alias for the global built-in @property decorator, but the name ‘property’ is still a valid way to refer to it.

Any ideas?

  • 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-30T21:53:27+00:00Added an answer on May 30, 2026 at 9:53 pm

    The problem with naming a property property is the following:

    class Foo(object):
        @property
        def property(self):
            return "ham"
    
        @property
        def other_property(self):
            return "spam"
    

    The second property can’t be defined since you’ve shadowed the name property in the class definition.

    You can get around this by “renaming” property as in your example, but if I were you, I wouldn’t mess with the built-ins in this way. It makes your code harder to follow.

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

Sidebar

Related Questions

Lets assume we have a class in python: class A(object): def __del__(self): print Del!
Is this possible? I want to have the To:, Body, and an Attachment all
I want to be able to create a python decorator that automatically registers class
I have a third-party GUI program that I'm wrapping with a Python class (using
Possible Duplicate: Can Super deal with multiple inheritance? Python inheritance? I have a class
I have a program in python that includes a class that takes a function
I'm trying to extend some base classes in Python: class xlist (list): def len(self):
I'm trying to write something like: class MyClass(object): @staticmethod def test(x, y, z=None): if
In Python 3 one can use super() instead of super(MyClass, self) , but this
I have a class in my Python module that frobs widgets. It has several

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.