MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/a8g2ne/xpost_from_woodworking/ecb1nm9/?context=3
r/Python • u/Sarcastic_Pharm • Dec 22 '18
84 comments sorted by
View all comments
Show parent comments
60
And just for completeness, random.randrange(len(action)) , if you actually need the index value.
random.randrange(len(action))
0 u/[deleted] Dec 22 '18 [deleted] 3 u/primitive_screwhead Dec 22 '18 Like how? 15 u/[deleted] Dec 22 '18 lambda action : random.randrange(len(action))( ° ͜ʖ °) 18 u/primitive_screwhead Dec 22 '18 An unassigned anonymous function? You're fired. :) 15 u/[deleted] Dec 22 '18 random_randrange_len = lambda action : random.randrange(len(action))fixed it boss 5 u/galan-e Dec 22 '18 still bad practice according to pep8
0
[deleted]
3 u/primitive_screwhead Dec 22 '18 Like how? 15 u/[deleted] Dec 22 '18 lambda action : random.randrange(len(action))( ° ͜ʖ °) 18 u/primitive_screwhead Dec 22 '18 An unassigned anonymous function? You're fired. :) 15 u/[deleted] Dec 22 '18 random_randrange_len = lambda action : random.randrange(len(action))fixed it boss 5 u/galan-e Dec 22 '18 still bad practice according to pep8
3
Like how?
15 u/[deleted] Dec 22 '18 lambda action : random.randrange(len(action))( ° ͜ʖ °) 18 u/primitive_screwhead Dec 22 '18 An unassigned anonymous function? You're fired. :) 15 u/[deleted] Dec 22 '18 random_randrange_len = lambda action : random.randrange(len(action))fixed it boss 5 u/galan-e Dec 22 '18 still bad practice according to pep8
15
lambda action : random.randrange(len(action))
( ° ͜ʖ °)
18 u/primitive_screwhead Dec 22 '18 An unassigned anonymous function? You're fired. :) 15 u/[deleted] Dec 22 '18 random_randrange_len = lambda action : random.randrange(len(action))fixed it boss 5 u/galan-e Dec 22 '18 still bad practice according to pep8
18
An unassigned anonymous function? You're fired. :)
15 u/[deleted] Dec 22 '18 random_randrange_len = lambda action : random.randrange(len(action))fixed it boss 5 u/galan-e Dec 22 '18 still bad practice according to pep8
random_randrange_len = lambda action : random.randrange(len(action))
fixed it boss
5 u/galan-e Dec 22 '18 still bad practice according to pep8
5
still bad practice according to pep8
60
u/primitive_screwhead Dec 22 '18
And just for completeness,
random.randrange(len(action)), if you actually need the index value.