I have a method:
def foo(bar):
# ...
Is there a way to mark bar as constant? Such as “The value in bar cannot change” or “The object pointed to by bar cannot change”.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If bar is an inmutable object, bar won’t change during the function.
You can also create your own constant object.
The recipe here.