On Sat, Jul 08, 2017 at 07:56:10PM -0600, Mats Wichmann wrote:
> From OO people, though, we get the sputtering But... But... what about
> encapsulation, data hiding, etc?
Regular attributes are still encapsulated. There's no difference in
encapsulation between:
obj.x # a standard attribute
obj
On 09/07/17 02:56, Mats Wichmann wrote:
> From OO people, though, we get the sputtering But... But... what about
> encapsulation, data hiding, etc?
Encapsulation isn't really an issue here since Pythons classes
fully encapsulate their data and methods. They just make them
both public.
Data Hidin
On 08Jul2017 16:03, Evuraan wrote:
I was hoping to learn when to use classmethod and when to use property.
They both seem similar (to me at least..), what's the pythonic way to
choose between them?
The core distinction is the context that the function needs. Does it depend on
the particular i
On 07/08/2017 06:56 PM, Steven D'Aprano wrote:
> The pythonic way is not to use them at all.
>
> For experts only: you'll know when you need them.
>
> They really aren't even a little bit similar, if you thought they did
> that just means that you haven't understood what they do.
>
> property
On Sat, Jul 08, 2017 at 04:03:24PM -0700, Evuraan wrote:
> Greetings!
>
> I was hoping to learn when to use classmethod and when to use property.
> They both seem similar (to me at least..), what's the pythonic way to
> choose between them?
The pythonic way is not to use them at all.
For experts
On 09/07/17 00:03, Evuraan wrote:
> I was hoping to learn when to use classmethod and when to use property.
> They both seem similar (to me at least..), what's the pythonic way to
> choose between them?
In fact they do completely different things.
A property is a field of an object that you acce
Greetings!
I was hoping to learn when to use classmethod and when to use property.
They both seem similar (to me at least..), what's the pythonic way to
choose between them?
$ cat ./try.py
#!/usr/bin/python3
class _someclass:
_tag = "sometag"
def __init__(self,_text):
self._text