MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/igvny1/python_goes_brrrr/g2wfem2/?context=3
r/ProgrammerHumor • u/das_freak • Aug 26 '20
789 comments sorted by
View all comments
1.3k
This is multiplying string by number. Multiplying strings would look like 'abc' * 'de'. Python goes kaput.
756 u/delinka Aug 26 '20 Result should be ‘adbdcd aebece’. Someone needs to fix this. 425 u/itoshkov Aug 26 '20 Remove the white space and we have a deal. :) 164 u/[deleted] Aug 26 '20 edited Aug 26 '20 ''.join(itertools.product('abc', 'de')) If you want me to fix it submit a ticket, thanks.edit: Ticket assigned, standby.import itertools as it ''.join(it.chain.from_iterable(it.product('abc', 'de'))) 108 u/Rasmaellin Aug 26 '20 (concat .) . liftA2 ((. flip (:) []) . (:)) 0 u/[deleted] Aug 26 '20 [deleted] 207 u/Andy_B_Goode Aug 26 '20 haha, perl goes @_->{$_} 52 u/RiddSann Aug 26 '20 Two letters : TFAs in, "tf is that shit that you've written". Seriously though, if Pearl uses that, I'm impressed by how opaque it seems 70 u/Andy_B_Goode Aug 26 '20 Yeah, that's why it's been called a "write-only language". Good luck reading it!Also, I tried running the example I used, and it gave me an error, but this:\@_{$_};Ran just fine. → More replies (3) 0 u/[deleted] Aug 26 '20 [deleted] 30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;" → More replies (1) 6 u/[deleted] Aug 26 '20 that makes perfect sense goddamnit. the named contextual element of the contextual hash array. :) → More replies (6) 29 u/Eiim Aug 26 '20 haha, golfing languages go ≔⟦⟧θWS⊞θι⊞υ⟦⊕Nω⟧≔⁰ηFυ«⪫θ¶←F§ι¹✳κ+¿∨ⅈⅉFruld«≔⌕….#§ι⁰∨⊟KD²✳κ+ζ¿⊕ζ⊞υEι⁺λ⎇μκ±ζ»≔¹η⎚»η → More replies (4) 12 u/jeremj22 Aug 26 '20 \xs ys -> concat [ x:y:[] | x<-xs, y<-ys ] → More replies (1) → More replies (7) 7 u/Telope Aug 26 '20 'You added the white space by clicking. You have only yourself to blame.' → More replies (1) 58 u/GaussWanker Aug 26 '20 Why? It seems you're treating abc as a*b*c but de as d+e, I think it should either be abcde (as it would be algebraicly or if 'x'*'y'=='x'+'y') or (a+b+c)*(d+e) = a*d+b*d+c*d+a*e+b*e+c*e = [something to be defined that probably doesn't equal abcde) 22 u/LosersCheckMyProfile Aug 26 '20 It’s matrix multiplication → More replies (5) 7 u/auser9 Aug 26 '20 Well considering ‘a’+’b’+’c’ gives you ‘abc’ I would say string attach by addition, and multiplication is undefined behavior → More replies (1) → More replies (1) 10 u/gabrielgio Aug 26 '20 Python can't multiply sequence by non-int of type 'str' 39 u/delinka Aug 26 '20 Not with that attitude 7 u/[deleted] Aug 26 '20 It can, it just chooses not to, because it's lazy 31 u/absurdlyinconvenient Aug 26 '20 why not dabceabc or adebdecde? Nevermind that multiplication always should be commutativeOr, let's go totally rogue and multiply the character codes and retranslate, fuck it 91 u/[deleted] Aug 26 '20 [removed] — view removed comment → More replies (2) 26 u/Phrodo_00 Aug 26 '20 Nevermind that multiplication always should be commutativeOnly in commutative rings like ℤ and ℝ 6 u/delinka Aug 26 '20 ^ this one’s going places! 8 u/absurdlyinconvenient Aug 26 '20 not good places, but places! → More replies (2) → More replies (10)
756
Result should be ‘adbdcd aebece’. Someone needs to fix this.
425 u/itoshkov Aug 26 '20 Remove the white space and we have a deal. :) 164 u/[deleted] Aug 26 '20 edited Aug 26 '20 ''.join(itertools.product('abc', 'de')) If you want me to fix it submit a ticket, thanks.edit: Ticket assigned, standby.import itertools as it ''.join(it.chain.from_iterable(it.product('abc', 'de'))) 108 u/Rasmaellin Aug 26 '20 (concat .) . liftA2 ((. flip (:) []) . (:)) 0 u/[deleted] Aug 26 '20 [deleted] 207 u/Andy_B_Goode Aug 26 '20 haha, perl goes @_->{$_} 52 u/RiddSann Aug 26 '20 Two letters : TFAs in, "tf is that shit that you've written". Seriously though, if Pearl uses that, I'm impressed by how opaque it seems 70 u/Andy_B_Goode Aug 26 '20 Yeah, that's why it's been called a "write-only language". Good luck reading it!Also, I tried running the example I used, and it gave me an error, but this:\@_{$_};Ran just fine. → More replies (3) 0 u/[deleted] Aug 26 '20 [deleted] 30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;" → More replies (1) 6 u/[deleted] Aug 26 '20 that makes perfect sense goddamnit. the named contextual element of the contextual hash array. :) → More replies (6) 29 u/Eiim Aug 26 '20 haha, golfing languages go ≔⟦⟧θWS⊞θι⊞υ⟦⊕Nω⟧≔⁰ηFυ«⪫θ¶←F§ι¹✳κ+¿∨ⅈⅉFruld«≔⌕….#§ι⁰∨⊟KD²✳κ+ζ¿⊕ζ⊞υEι⁺λ⎇μκ±ζ»≔¹η⎚»η → More replies (4) 12 u/jeremj22 Aug 26 '20 \xs ys -> concat [ x:y:[] | x<-xs, y<-ys ] → More replies (1) → More replies (7) 7 u/Telope Aug 26 '20 'You added the white space by clicking. You have only yourself to blame.' → More replies (1) 58 u/GaussWanker Aug 26 '20 Why? It seems you're treating abc as a*b*c but de as d+e, I think it should either be abcde (as it would be algebraicly or if 'x'*'y'=='x'+'y') or (a+b+c)*(d+e) = a*d+b*d+c*d+a*e+b*e+c*e = [something to be defined that probably doesn't equal abcde) 22 u/LosersCheckMyProfile Aug 26 '20 It’s matrix multiplication → More replies (5) 7 u/auser9 Aug 26 '20 Well considering ‘a’+’b’+’c’ gives you ‘abc’ I would say string attach by addition, and multiplication is undefined behavior → More replies (1) → More replies (1) 10 u/gabrielgio Aug 26 '20 Python can't multiply sequence by non-int of type 'str' 39 u/delinka Aug 26 '20 Not with that attitude 7 u/[deleted] Aug 26 '20 It can, it just chooses not to, because it's lazy 31 u/absurdlyinconvenient Aug 26 '20 why not dabceabc or adebdecde? Nevermind that multiplication always should be commutativeOr, let's go totally rogue and multiply the character codes and retranslate, fuck it 91 u/[deleted] Aug 26 '20 [removed] — view removed comment → More replies (2) 26 u/Phrodo_00 Aug 26 '20 Nevermind that multiplication always should be commutativeOnly in commutative rings like ℤ and ℝ 6 u/delinka Aug 26 '20 ^ this one’s going places! 8 u/absurdlyinconvenient Aug 26 '20 not good places, but places! → More replies (2) → More replies (10)
425
Remove the white space and we have a deal. :)
164 u/[deleted] Aug 26 '20 edited Aug 26 '20 ''.join(itertools.product('abc', 'de')) If you want me to fix it submit a ticket, thanks.edit: Ticket assigned, standby.import itertools as it ''.join(it.chain.from_iterable(it.product('abc', 'de'))) 108 u/Rasmaellin Aug 26 '20 (concat .) . liftA2 ((. flip (:) []) . (:)) 0 u/[deleted] Aug 26 '20 [deleted] 207 u/Andy_B_Goode Aug 26 '20 haha, perl goes @_->{$_} 52 u/RiddSann Aug 26 '20 Two letters : TFAs in, "tf is that shit that you've written". Seriously though, if Pearl uses that, I'm impressed by how opaque it seems 70 u/Andy_B_Goode Aug 26 '20 Yeah, that's why it's been called a "write-only language". Good luck reading it!Also, I tried running the example I used, and it gave me an error, but this:\@_{$_};Ran just fine. → More replies (3) 0 u/[deleted] Aug 26 '20 [deleted] 30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;" → More replies (1) 6 u/[deleted] Aug 26 '20 that makes perfect sense goddamnit. the named contextual element of the contextual hash array. :) → More replies (6) 29 u/Eiim Aug 26 '20 haha, golfing languages go ≔⟦⟧θWS⊞θι⊞υ⟦⊕Nω⟧≔⁰ηFυ«⪫θ¶←F§ι¹✳κ+¿∨ⅈⅉFruld«≔⌕….#§ι⁰∨⊟KD²✳κ+ζ¿⊕ζ⊞υEι⁺λ⎇μκ±ζ»≔¹η⎚»η → More replies (4) 12 u/jeremj22 Aug 26 '20 \xs ys -> concat [ x:y:[] | x<-xs, y<-ys ] → More replies (1) → More replies (7) 7 u/Telope Aug 26 '20 'You added the white space by clicking. You have only yourself to blame.' → More replies (1)
164
''.join(itertools.product('abc', 'de')) If you want me to fix it submit a ticket, thanks.
edit: Ticket assigned, standby.
import itertools as it ''.join(it.chain.from_iterable(it.product('abc', 'de')))
108 u/Rasmaellin Aug 26 '20 (concat .) . liftA2 ((. flip (:) []) . (:)) 0 u/[deleted] Aug 26 '20 [deleted] 207 u/Andy_B_Goode Aug 26 '20 haha, perl goes @_->{$_} 52 u/RiddSann Aug 26 '20 Two letters : TFAs in, "tf is that shit that you've written". Seriously though, if Pearl uses that, I'm impressed by how opaque it seems 70 u/Andy_B_Goode Aug 26 '20 Yeah, that's why it's been called a "write-only language". Good luck reading it!Also, I tried running the example I used, and it gave me an error, but this:\@_{$_};Ran just fine. → More replies (3) 0 u/[deleted] Aug 26 '20 [deleted] 30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;" → More replies (1) 6 u/[deleted] Aug 26 '20 that makes perfect sense goddamnit. the named contextual element of the contextual hash array. :) → More replies (6) 29 u/Eiim Aug 26 '20 haha, golfing languages go ≔⟦⟧θWS⊞θι⊞υ⟦⊕Nω⟧≔⁰ηFυ«⪫θ¶←F§ι¹✳κ+¿∨ⅈⅉFruld«≔⌕….#§ι⁰∨⊟KD²✳κ+ζ¿⊕ζ⊞υEι⁺λ⎇μκ±ζ»≔¹η⎚»η → More replies (4) 12 u/jeremj22 Aug 26 '20 \xs ys -> concat [ x:y:[] | x<-xs, y<-ys ] → More replies (1) → More replies (7)
108
(concat .) . liftA2 ((. flip (:) []) . (:))
0 u/[deleted] Aug 26 '20 [deleted] 207 u/Andy_B_Goode Aug 26 '20 haha, perl goes @_->{$_} 52 u/RiddSann Aug 26 '20 Two letters : TFAs in, "tf is that shit that you've written". Seriously though, if Pearl uses that, I'm impressed by how opaque it seems 70 u/Andy_B_Goode Aug 26 '20 Yeah, that's why it's been called a "write-only language". Good luck reading it!Also, I tried running the example I used, and it gave me an error, but this:\@_{$_};Ran just fine. → More replies (3) 0 u/[deleted] Aug 26 '20 [deleted] 30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;" → More replies (1) 6 u/[deleted] Aug 26 '20 that makes perfect sense goddamnit. the named contextual element of the contextual hash array. :) → More replies (6) 29 u/Eiim Aug 26 '20 haha, golfing languages go ≔⟦⟧θWS⊞θι⊞υ⟦⊕Nω⟧≔⁰ηFυ«⪫θ¶←F§ι¹✳κ+¿∨ⅈⅉFruld«≔⌕….#§ι⁰∨⊟KD²✳κ+ζ¿⊕ζ⊞υEι⁺λ⎇μκ±ζ»≔¹η⎚»η → More replies (4) 12 u/jeremj22 Aug 26 '20 \xs ys -> concat [ x:y:[] | x<-xs, y<-ys ] → More replies (1)
0
[deleted]
207 u/Andy_B_Goode Aug 26 '20 haha, perl goes @_->{$_} 52 u/RiddSann Aug 26 '20 Two letters : TFAs in, "tf is that shit that you've written". Seriously though, if Pearl uses that, I'm impressed by how opaque it seems 70 u/Andy_B_Goode Aug 26 '20 Yeah, that's why it's been called a "write-only language". Good luck reading it!Also, I tried running the example I used, and it gave me an error, but this:\@_{$_};Ran just fine. → More replies (3) 0 u/[deleted] Aug 26 '20 [deleted] 30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;" → More replies (1) 6 u/[deleted] Aug 26 '20 that makes perfect sense goddamnit. the named contextual element of the contextual hash array. :) → More replies (6) 29 u/Eiim Aug 26 '20 haha, golfing languages go ≔⟦⟧θWS⊞θι⊞υ⟦⊕Nω⟧≔⁰ηFυ«⪫θ¶←F§ι¹✳κ+¿∨ⅈⅉFruld«≔⌕….#§ι⁰∨⊟KD²✳κ+ζ¿⊕ζ⊞υEι⁺λ⎇μκ±ζ»≔¹η⎚»η → More replies (4)
207
haha, perl goes @_->{$_}
52 u/RiddSann Aug 26 '20 Two letters : TFAs in, "tf is that shit that you've written". Seriously though, if Pearl uses that, I'm impressed by how opaque it seems 70 u/Andy_B_Goode Aug 26 '20 Yeah, that's why it's been called a "write-only language". Good luck reading it!Also, I tried running the example I used, and it gave me an error, but this:\@_{$_};Ran just fine. → More replies (3) 0 u/[deleted] Aug 26 '20 [deleted] 30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;" → More replies (1) 6 u/[deleted] Aug 26 '20 that makes perfect sense goddamnit. the named contextual element of the contextual hash array. :) → More replies (6)
52
Two letters : TF
As in, "tf is that shit that you've written". Seriously though, if Pearl uses that, I'm impressed by how opaque it seems
70 u/Andy_B_Goode Aug 26 '20 Yeah, that's why it's been called a "write-only language". Good luck reading it!Also, I tried running the example I used, and it gave me an error, but this:\@_{$_};Ran just fine. → More replies (3) 0 u/[deleted] Aug 26 '20 [deleted] 30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;" → More replies (1)
70
Yeah, that's why it's been called a "write-only language". Good luck reading it!
Also, I tried running the example I used, and it gave me an error, but this:
\@_{$_};
Ran just fine.
→ More replies (3)
30 u/npsimons Aug 26 '20 I read somewhere that python prefers alphabetic keywords while perl prefers symbols.There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;"
30
I read somewhere that python prefers alphabetic keywords while perl prefers symbols.
There's a great Perl module called, appropriately enough, "English". So to enable more readable code, literally "use English;"
6
that makes perfect sense goddamnit. the named contextual element of the contextual hash array. :)
29
haha, golfing languages go ≔⟦⟧θWS⊞θι⊞υ⟦⊕Nω⟧≔⁰ηFυ«⪫θ¶←F§ι¹✳κ+¿∨ⅈⅉFruld«≔⌕….#§ι⁰∨⊟KD²✳κ+ζ¿⊕ζ⊞υEι⁺λ⎇μκ±ζ»≔¹η⎚»η
12
\xs ys -> concat [ x:y:[] | x<-xs, y<-ys ]
7
'You added the white space by clicking. You have only yourself to blame.'
58
Why? It seems you're treating abc as a*b*c but de as d+e, I think it should either be abcde (as it would be algebraicly or if 'x'*'y'=='x'+'y') or (a+b+c)*(d+e) = a*d+b*d+c*d+a*e+b*e+c*e = [something to be defined that probably doesn't equal abcde)
22 u/LosersCheckMyProfile Aug 26 '20 It’s matrix multiplication → More replies (5) 7 u/auser9 Aug 26 '20 Well considering ‘a’+’b’+’c’ gives you ‘abc’ I would say string attach by addition, and multiplication is undefined behavior → More replies (1) → More replies (1)
22
It’s matrix multiplication
→ More replies (5)
Well considering ‘a’+’b’+’c’ gives you ‘abc’ I would say string attach by addition, and multiplication is undefined behavior
→ More replies (1)
10
Python can't multiply sequence by non-int of type 'str'
39 u/delinka Aug 26 '20 Not with that attitude 7 u/[deleted] Aug 26 '20 It can, it just chooses not to, because it's lazy
39
Not with that attitude
It can, it just chooses not to, because it's lazy
31
why not dabceabc or adebdecde? Nevermind that multiplication always should be commutative
Or, let's go totally rogue and multiply the character codes and retranslate, fuck it
91 u/[deleted] Aug 26 '20 [removed] — view removed comment → More replies (2) 26 u/Phrodo_00 Aug 26 '20 Nevermind that multiplication always should be commutativeOnly in commutative rings like ℤ and ℝ 6 u/delinka Aug 26 '20 ^ this one’s going places! 8 u/absurdlyinconvenient Aug 26 '20 not good places, but places! → More replies (2)
91
[removed] — view removed comment
→ More replies (2)
26
Nevermind that multiplication always should be commutative
Only in commutative rings like ℤ and ℝ
^ this one’s going places!
8 u/absurdlyinconvenient Aug 26 '20 not good places, but places! → More replies (2)
8
not good places, but places!
1.3k
u/itoshkov Aug 26 '20
This is multiplying string by number. Multiplying strings would look like 'abc' * 'de'. Python goes kaput.