The right way to 'call' a class attribute inside the same class
Juan C.
juan0christian at gmail.com
Mon Dec 12 12:57:28 EST 2016
More information about the Python-list mailing list
Mon Dec 12 12:57:28 EST 2016
- Previous message (by thread): The right way to 'call' a class attribute inside the same class
- Next message (by thread): The right way to 'call' a class attribute inside the same class
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Dec 12, 2016 at 12:34 PM, Thomas 'PointedEars' Lahn <PointedEars at web.de> wrote: > First of all, the proper term for what you are doing there is _not_ “call”; > you are _accessing_ an attribute instead. Indeed, `accessing` seems better. I was looking for a better word but couldn't find at the moment. > To call something means generally in programming, and in Python, to execute > it as a function instead: In the code above, the class object referred to by > “Box” is called twice in order to instantiate twice (calling a class object > in Python means to instantiate it, implicitly calling its constructor > method, “__init__”, if any), and the global “print” function is called three > times. Since we are talking about Python terminology I believe that calling `__init__` a constructor is also wrong. I've already seem some discussions regarding it and the general consensus is that `__init__` shouldn't be called constructor as it isn't really a constructor (like Java/C# constructors). Some source: - http://stackoverflow.com/questions/4859129/python-and-python-c-api-new-versus-init - http://stackoverflow.com/questions/674304/pythons-use-of-new-and-init
- Previous message (by thread): The right way to 'call' a class attribute inside the same class
- Next message (by thread): The right way to 'call' a class attribute inside the same class
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list