-
-
Save amcgregor/90bc7ee3a76941b294856c6199eb38d2 to your computer and use it in GitHub Desktop.
Attempting to grok data descriptor contributions to Python annotations.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from dataclasses import dataclass | |
class String: | |
def __get__(self, obj, cls=None) -> str: | |
return "I'm a string!" | |
class Sample: | |
stringy: str = String() | |
class Example: | |
stringy = String() | |
@dataclass | |
class Dataclass: | |
stringy: str = String() | |
if __name__ == '__main__': | |
help(Sample) | |
help(Example) | |
help(Dataclass) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment