Skip to content

Comments

Add some code golf examples#1

Merged
sellisd merged 1 commit intomainfrom
AFOS/add_golf
Mar 12, 2025
Merged

Add some code golf examples#1
sellisd merged 1 commit intomainfrom
AFOS/add_golf

Conversation

@sellisd
Copy link
Collaborator

@sellisd sellisd commented Mar 12, 2025

Will find more later

Will find more later
@sellisd sellisd requested a review from Copilot March 12, 2025 15:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new file containing code golf examples intended as experimental functions.

  • Adds a new file "src/golf/golf.py" with golfed code for demonstration.
  • Implements a compact function (e2) and a lambda expression using eval for code golfing.
Comments suppressed due to low confidence (4)

src/golf/golf.py:4

  • [nitpick] The alias '_p' for the built-in print function is not very descriptive. Consider using the built-in print directly or a more meaningful alias to improve readability.
+_p=print

src/golf/golf.py:6

  • [nitpick] The function name 'e2' is ambiguous. Consider renaming it to something more descriptive that reflects its purpose.
+def e2(s):

src/golf/golf.py:8

  • [nitpick] The slicing operation on the string "FTarlusee" using a boolean expression is unclear. Consider adding an inline comment or refactoring this logic for better clarity.
+    return "FTarlusee"[a==b::2]+"".join(c)

src/golf/golf.py:12

  • Using eval in the lambda can lead to potential security risks or unintended behavior if inputs are not strictly controlled. Consider using a safer alternative or ensuring input sanitization.
+    _p((lambda a,b,c:eval(a*b+c))("b+",3,"b**7"))

@sellisd sellisd merged commit c390f54 into main Mar 12, 2025
1 check passed
@sellisd sellisd deleted the AFOS/add_golf branch March 12, 2025 16:05
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.

2 participants