title: How to create an optional field in a dataclass that is inherited?
body: <pre class="lang-py prettyprint-override"><code>from typing import Optional
  
  @dataclass
  class Event:
     id: str
     created_at: datetime
     updated_at: Optional[datetime]
     #updated_at: datetime = field(default_factory=datetime.now)  CASE 1
     #updated_at: Optional[datetime] = None                       CASE 2
  
  @dataclass
  class NamedEvent(Event):
    name: str
  
  </code></pre>
  
  <p>When creating an event instance I will generally not have an <code>updated_at</code> field. I can either pass the <code>current time</code> as default value or add a value to it when making the insertion in the database and fetch it in subsequent uses of the object. Which is the better way? 
  As per my understanding, I cannot create a <code>NamedEvent</code> instance <em>without passing the updated_at</em> field in case1 and case2 since I do not have a default value in name field. </p>