MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/it4x8o/python_39_all_you_need_to_know/g5cs30o/?context=3
r/Python • u/cheerfulboy • Sep 15 '20
204 comments sorted by
View all comments
Show parent comments
0
[deleted]
142 u/kankyo Sep 15 '20 Those people would have done s[:-4] previously anyway. Using the new stuff is WAY WAY better. 0 u/[deleted] Sep 15 '20 [deleted] 13 u/kankyo Sep 15 '20 I think that's worse :P 0 u/[deleted] Sep 15 '20 [deleted] 19 u/Enzyesha Sep 15 '20 I mean, you just moved the magic number. And now it's wordier, and you're passing a non-index value to the [] operator, which looks really alien. I agree, this is much worse 13 u/kankyo Sep 15 '20 You can dos[:-len('.txt')]which is way nicer. 4 u/tjthejuggler Sep 15 '20 Oh cool, I really like this. I hope I remember it when the opportunity arises. 1 u/nitroll Sep 16 '20 But the whole point is that you should use .removesuffix from 3.9 and on!
142
Those people would have done s[:-4] previously anyway. Using the new stuff is WAY WAY better.
s[:-4]
0 u/[deleted] Sep 15 '20 [deleted] 13 u/kankyo Sep 15 '20 I think that's worse :P 0 u/[deleted] Sep 15 '20 [deleted] 19 u/Enzyesha Sep 15 '20 I mean, you just moved the magic number. And now it's wordier, and you're passing a non-index value to the [] operator, which looks really alien. I agree, this is much worse 13 u/kankyo Sep 15 '20 You can dos[:-len('.txt')]which is way nicer. 4 u/tjthejuggler Sep 15 '20 Oh cool, I really like this. I hope I remember it when the opportunity arises. 1 u/nitroll Sep 16 '20 But the whole point is that you should use .removesuffix from 3.9 and on!
13 u/kankyo Sep 15 '20 I think that's worse :P 0 u/[deleted] Sep 15 '20 [deleted] 19 u/Enzyesha Sep 15 '20 I mean, you just moved the magic number. And now it's wordier, and you're passing a non-index value to the [] operator, which looks really alien. I agree, this is much worse 13 u/kankyo Sep 15 '20 You can dos[:-len('.txt')]which is way nicer. 4 u/tjthejuggler Sep 15 '20 Oh cool, I really like this. I hope I remember it when the opportunity arises. 1 u/nitroll Sep 16 '20 But the whole point is that you should use .removesuffix from 3.9 and on!
13
I think that's worse :P
0 u/[deleted] Sep 15 '20 [deleted] 19 u/Enzyesha Sep 15 '20 I mean, you just moved the magic number. And now it's wordier, and you're passing a non-index value to the [] operator, which looks really alien. I agree, this is much worse 13 u/kankyo Sep 15 '20 You can dos[:-len('.txt')]which is way nicer. 4 u/tjthejuggler Sep 15 '20 Oh cool, I really like this. I hope I remember it when the opportunity arises. 1 u/nitroll Sep 16 '20 But the whole point is that you should use .removesuffix from 3.9 and on!
19 u/Enzyesha Sep 15 '20 I mean, you just moved the magic number. And now it's wordier, and you're passing a non-index value to the [] operator, which looks really alien. I agree, this is much worse 13 u/kankyo Sep 15 '20 You can dos[:-len('.txt')]which is way nicer. 4 u/tjthejuggler Sep 15 '20 Oh cool, I really like this. I hope I remember it when the opportunity arises. 1 u/nitroll Sep 16 '20 But the whole point is that you should use .removesuffix from 3.9 and on!
19
I mean, you just moved the magic number. And now it's wordier, and you're passing a non-index value to the [] operator, which looks really alien. I agree, this is much worse
You can do
s[:-len('.txt')]
which is way nicer.
4 u/tjthejuggler Sep 15 '20 Oh cool, I really like this. I hope I remember it when the opportunity arises. 1 u/nitroll Sep 16 '20 But the whole point is that you should use .removesuffix from 3.9 and on!
4
Oh cool, I really like this. I hope I remember it when the opportunity arises.
1 u/nitroll Sep 16 '20 But the whole point is that you should use .removesuffix from 3.9 and on!
1
But the whole point is that you should use .removesuffix from 3.9 and on!
0
u/[deleted] Sep 15 '20
[deleted]