Skip to main content

Timeline for Tips for golfing in Python

Current License: CC BY-SA 3.0

13 events
when toggle format what by license comment
Jun 13, 2019 at 14:12 comment added Miriam @sasha True, I should've tested it.
Jun 13, 2019 at 11:48 comment added AndJM @ArtemisFowl, no it's ok as is, the comma after the 1 creates a tuple which is iterable.
Mar 26, 2019 at 22:58 comment added Miriam if r=1, r*8 is 8, and you can't iterate through a number. I guess you meant r=[1]
Jun 4, 2017 at 18:41 comment added Artyer If this is being used in a list comprehension, this can be used to loop with a variable. Useful in lambdas. What I'm saying is instead of for i in[1]*n:a=(expression);, you do for a in[expression]*n:
May 19, 2016 at 19:23 comment added DJMcMayhem exec"pass;"*8 is significantly shorter.
Feb 1, 2016 at 10:19 comment added undergroundmonorail @MorganThrapp how does that save bytes over for i in[1]*8:pass?
Jul 28, 2015 at 12:31 history edited lynn CC BY-SA 3.0
deleted 263 characters in body
Feb 20, 2015 at 2:35 history wiki removed Doorknob
Aug 18, 2014 at 17:31 history edited proud haskeller CC BY-SA 3.0
returned the removed line
Aug 18, 2014 at 17:30 comment added proud haskeller oh, right, i didn't understand that. fixed now
Aug 18, 2014 at 17:13 comment added undergroundmonorail @proudhaskeller I think the point of the line you removed was that "In addition to the obvious character savings you get because [1]*8 is shorter than range(8), you also get to save a space because for i in[... is legal while for i in range... is not".
Aug 18, 2014 at 16:09 history edited proud haskeller CC BY-SA 3.0
the space wasn't there already
Mar 4, 2012 at 21:32 history answered Blazer CC BY-SA 3.0