-1

I found in builtins python objects a one named property. The docstring for this says:
Typical use is to define a managed attribute x:
But I don't understend what that means

Could someone explain when and for what we must use this?

  • 1
    Not exactly duplicates, but [What's the pythonic way to use getters and setters?](https://stackoverflow.com/q/2627002/364696) and [How does the @property decorator work?](https://stackoverflow.com/q/17330160/364696) should answer your question. – ShadowRanger Apr 11 '20 at 03:15
  • Wow, nothing in python is transparent. Thanks! – Cristian Contrera Apr 11 '20 at 03:20
  • 3
    The [online documentation](https://docs.python.org/3/library/functions.html#property) is typically more detailed than the docstrings. – user2357112 Apr 11 '20 at 03:29
  • 2
    Please repeat the intro tour, especially [how to ask](https://stackoverflow.com/help/how-to-ask). To wit, "Search, and research". You should have a specific question regarding the documentation, not a generic request to explain the feature. – Prune Apr 11 '20 at 04:04

2 Answers2

0

Note that builtins will return standard built-in objects in python3, It provides direct access to all ‘built-in’ identifiers of Python. You can find more information in https://docs.python.org/3/library/builtins.html

   >>> import builtins
   >>> vars(globals()['__builtins__']) is vars(builtins)
    True
John
  • 147
  • 1
  • 10
0

What a builtin.property does is that takes your property and returns attributes for different style classes and what that means that it will be classes that come from an object. What a builtin does is that it is made up of many different functions that are built in, which is obvious but the typical use is to give an attribute about x. This below is an example. If you need any other on builtins or other python Functions go to https://help.kite.com/article/63-using-the-copilot That is where I got the Example. If you want to find more detail about the example type in the search builtin.property. Typical use is to define a managed attribute x that means to return the featureless object x

 class C(object):
    def __init__(self):
        self._x = None

    def getx(self):
        return self._x
    def setx(self, value):
        self._x = value
    def delx(self):
        del self._x
    x = property(getx, setx, delx, "I'm the 'x' property.")