0

How would I do something like this?

guy = for
guy i in range():
    (placeholder)

I am pretty sure this is possible but don't know how to go about wording the question to find out the answer.

4
  • 2
    You can't do this. You can't use variables for the language syntax elements. Commented Apr 28, 2021 at 21:41
  • 4
    No, it's not possible for is not a function, it is a statement. Very different. Commented Apr 28, 2021 at 21:41
  • 1
    You may want to learn lisp. Horrible practices like that are easy in lisp. Commented Apr 28, 2021 at 21:42
  • 2
    Please explain your use case for wanting to do this. What other values would you want for guy, and how is this useful to you? Commented Apr 28, 2021 at 21:45

2 Answers 2

2

You cannot make an alias for a syntactic keyword; those words are hard-coded into the language definition. I suspect that you have an "X-Y problem" -- using the wrong specific technique on a more general problem.

Sign up to request clarification or add additional context in comments.

Comments

0

Since for is not a function but is rather a keyword, (functions have a little parenthesis at the end, such as foo()). This is not possible with keywords, but is possible with functions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.