Skip to main content

Timeline for Tips for golfing in Python

Current License: CC BY-SA 4.0

14 events
when toggle format what by license comment
S Aug 17 at 16:48 history suggested W D CC BY-SA 4.0
add match/case, condense code blocks | extra code can just be done with exec{...}[k];insertExtraCodeHere() so removed that part
Aug 17 at 11:03 comment added W D Extra code can be run with exec{...}[k];func() instead of (previously) exec{...}[k]+";func()", being 3 bytes shorter
Aug 17 at 11:02 review Suggested edits
S Aug 17 at 16:48
Nov 3, 2021 at 15:43 comment added Larry Bagel Note that the match statement was added in 3.10. python.org/dev/peps/pep-0636
S Jan 25, 2019 at 22:18 history suggested Starwort CC BY-SA 4.0
This shouldn't have been wrapped in exec
Jan 25, 2019 at 21:14 review Suggested edits
S Jan 25, 2019 at 22:18
S Nov 17, 2018 at 16:41 history suggested Starwort CC BY-SA 4.0
Added dict of functions method
Nov 17, 2018 at 10:54 review Suggested edits
S Nov 17, 2018 at 16:41
Oct 27, 2018 at 14:13 comment added Kateba If you have strings as keys, using dict(s1=v1,s2=v2,...,sn=vn) instead of {'s1':v1,'s2':v2,...,'sn':vn} saves 2*n-4 bytes and is better if n>=3
Oct 13, 2016 at 19:25 comment added Cyoce Although instead of using a dictionary with numbered keys in the first example, you should just use a list
Feb 20, 2015 at 2:35 history wiki removed Doorknob
Nov 19, 2014 at 12:51 comment added HalosGhost This is something i would deeply consider using in the wild. I do so miss my switch statements! +1
Oct 25, 2014 at 5:55 history edited Justin CC BY-SA 3.0
added 38 characters in body
Apr 12, 2014 at 19:44 history answered Justin CC BY-SA 3.0