title: python - property() in a Class use problem, setter shows TypeError
body: <p>I'm coding a pybite on codechalleng.es and totally run out of ideas.
  Problem is as follows:
  <a href="https://i.stack.imgur.com/AiWVP.png" rel="nofollow noreferrer">task description</a></p>
  
  <p>I need to write a class that returns boolean True/False whether the promotion has expired or not.
  It's tested by invoking a property getter promotion.expired (see tests at the very end)</p>
  
  <pre><code>from datetime import datetime, timedelta
  
  NOW = datetime.now()    # defined here for test compatilibity (time)
  
  class Promo:
      """ docstring hehe"""
  
      def __init__(self, name, expires):
          self.name = name
          self.setpromo(expires)
  
  
      def checkpromo(self):
          return self.expired
  
      def setpromo(self, value):
          self.expired = value &lt; datetime.now()
  
      expired = property(checkpromo, setpromo)
  
  
  test_time = NOW + timedelta(days=1)
  
  promotion_10 = Promo('promotion 10%', test_time)
  </code></pre>
  
  <p>Now it throws an error where i can't compare value in setter vs. datetime object. In my opinion as we pass test_time (a datetime object) into setter, it should be able to compare datetime vs. datetime - instead the program says it's a bool. Not sure how to proceed. Thank you for any insight.</p>
  
  <pre><code>Traceback (most recent call last):
    File "/tmp/simple_property.py", line 24, in &lt;module&gt;
  promotion_10 = Promo('promotion 10%', test_time)
    File "/tmp/simple_property.py", line 10, in __init__
  self.setpromo(expires)
    File "/tmp/simple_property.py", line 17, in setpromo
  self.expired = value &lt; datetime.now()
    File "/tmp/simple_property.py", line 17, in setpromo
  self.expired = value &lt; datetime.now()
  TypeError: '&lt;' not supported between instances of 'bool' and 'datetime.datetime'  
  </code></pre>
  
  <p>tests that needs to pass:</p>
  
  <pre><code>from datetime import timedelta
  import inspect
  
  from simple_property import Promo, NOW
  
  
  def test_promo_expired():
      past_time = NOW - timedelta(seconds=3)
      twitter_promo = Promo('twitter', past_time)
      assert twitter_promo.expired
  
  
  def test_promo_not_expired():
      future_date = NOW + timedelta(days=1)
      newsletter_promo = Promo('newsletter', future_date)
      assert not newsletter_promo.expired
  
  
  def test_uses_property():
      assert 'property' in inspect.getsource(Promo)
  </code></pre>