Created
June 29, 2021 07:47
-
-
Save PythonDotLand/6737ff43199abfecdc1dfe74c74a0115 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| >>> class Card: | |
| ... __slots__ = 'rank', 'suite' | |
| ... def __init__(self, rank, suite): | |
| ... self.rank = rank | |
| ... self.suite = suite | |
| ... | |
| >>> qh = Card('queen', 'hearts') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see. You are right. It seems I am too preoccupied with the subject of writing faster, so I isolated that! :) In fact, for a moment I believed that this "solts" thing allows for not having to add the very stupid, annoying and time wasting 'self' prefix everytime to e.g. 'rank' and 'suite' ! :)) (I know well though that it is necessary and why, as in Java, with the corresp. prefix 'this'.)
Thanks and sorry about the trouble!