4 ms·
The body of your second version of __init__() in one line: self.min, self.max = sorted((min, max)) This may be what was meant with the sentence that claims "b
by detcader 12y ago
The body of your second version of __init__() in one line:
self.min, self.max = sorted((min, max))
This may be what was meant with the sentence that claims "but eventually you'll need a line like this outside of init" but I'm not sure what that part means. (I generally support functional programming practices, which Python leaves a lot of room for).
Or, you could subclass tuple.
- andreasvc 12y agoThat line means that in some other method than init you will likely need to write into a line that refers to self attributes > 4 times and you will have the same issue but this time it's not avoidable.