I’ve been exposed to C/C++/Java like syntax over the years, and the way that Python variables are defined just sort of confuses me. Can anyone describe what the differences are among the three mentioned in the q?
Share
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.
selfworks just like thethisfrom C++ and Java. You get a reference to an object that you can then access with the.operator (->in C++).In Python the only way of accessing instance variables is explicitely through
self. Instance variables are not placed in the same “normal” scope as local or global variables are.