#๐ why both have diff init but works the same
11 messages ยท Page 1 of 1 (latest)
@cobalt turtle
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Because they both set ._name and access it. They're the same code, you've only changed the name of property you're using.
i learned yesterday that when the init is called it sends the valuue to the setter method..is that correct?
i think gpt says that..if i call the private attribute in the init then the setter doesn't get called and if i wrote a public name in the init , setter gets called.
@celest berry
__init__ is just a method like any other method
Doing self.get_func = name tries to set .get_func, and that's a property so it callers your setter function with name.
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.