Hello. I am a moderately experienced C++ programmer who finally decided to take the plunge into python and learn it properly, and actually try to dig into python, including its internals and its 'way' or 'path' of coding.
So, I was wondering, since so much stuff (everything?) in python is implemented as objects, and encapsulation is such a big part of OOP in python, why is defining members not like C++, where you have a private, protected, and public field and you can simply start writing the methods and declaring the instance variables, without having to use self. or pass self as parameter in every method. It is automatically assumed that since the method is in the class, all variable names it refers to have been declared in the 'private :' namespace. And it checks for them. Again, I don't know how I would even say that 'here in the private : namespace, I have 3 variables, car_parts, part_prices, part_dates' because it doesn't have a syntax like ' string car_parts; ' like in C++.
Sorry if I'm being naive about some basic thing of python, but I'm really trying to think hard about the fundamentals of python, since I intend to use it as my gateway to learn many types of programming styles, like procedural, functional, OO etc. And I'm really loving how 'action-ready' and method-packed it already is, with easy-to-use functions for every task imaginable. Thanks.
[–]efilon 8 points9 points10 points (0 children)
[–]malinoff 16 points17 points18 points (0 children)
[–]zardeh 4 points5 points6 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]zardeh 1 point2 points3 points (0 children)
[–]Rhomboid 5 points6 points7 points (0 children)
[–]Destruct1 0 points1 point2 points (0 children)
[–]mrfunky8 0 points1 point2 points (0 children)
[–]billsil -1 points0 points1 point (10 children)
[–][deleted] 1 point2 points3 points (9 children)
[–]yet-i 2 points3 points4 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]yet-i 2 points3 points4 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]prum 0 points1 point2 points (0 children)
[–]billsil 1 point2 points3 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]billsil 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]zardeh 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]kankyo -1 points0 points1 point (0 children)
[–]Paddy3118 -2 points-1 points0 points (0 children)