On 9/6/2017 7:41 PM, Stefan Ram wrote:

The following code runs here:

Your code runs but that's not how I have mine code set up. Here's the revised code:


class Requestor(object):
    def __init__(self, user_id, user_name ):
        self._page_start = -1

    @property
    def page_start(self):
        return self._page_start

    @page_start.setter
    def page_start(self, number):
        self._page_start = number



class Scraper(object):
     def __init__(self, user_id, user_name):
         self.requestor = Requestor(user_id, user_name)
     @property
     def page_start(self):
         return self.requestor.page_start
     @page_start.setter
     def page_start(self, number):
         self.requestor.page_start = number

>>> test = Scraper(1, 1)
>>> test.page_start
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<input>", line 20, in page_start
AttributeError: 'Requestor' object has no attribute 'page_start'


That's a slightly different error than what I got my code, where the Scraper object didn't have the attribute.

Could it be that @property item can't call another @property item?

Thank you,

Chris R.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to