Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from typing import final
@final
class Song:
artist: str
title: str
album: str
year: int
class Derived(Song): # ERROR: Can't inherit from final class "Song"
studio: str
# ---------------------
from typing import Final
class Song:
artist: str
title: str
album: str
year: Final = 2019
class 2020Song(Song):
Final = 2020 # ERROR: Can't override a final field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment