Skip to content

Update apt.py: Python golf!#27

Open
jaseg wants to merge 1 commit into
Aeronautics:developfrom
jaseg:patch-2
Open

Update apt.py: Python golf!#27
jaseg wants to merge 1 commit into
Aeronautics:developfrom
jaseg:patch-2

Conversation

@jaseg
Copy link
Copy Markdown

@jaseg jaseg commented Dec 1, 2013

Untested, should work down to python 2.7 though. Python versions prior to 2.7 do not have dict comprehension.

These changes should reduce overhead by only doing re.match/str.find once instead of twice.

Depending on the amount of matching this needs to do, it might be worth considering re2 instead of python's default re.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant