Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created October 21, 2019 13:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save NMZivkovic/9db49d5f524f4f99db0fdbd8581315f9 to your computer and use it in GitHub Desktop.
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