Re: function v. method
Antoon Pardon wrote:
He doesn't, but it's clear that *you* didn't understand what
fuzzylollipop meant !-)
Hint : add a comma at the right place so parsing is unambigous:
"""
If you reference _vara in your code and it is in someone elses module,
you don't understand YOU ARE NOT SUPPOSED TO DO THAT!
"""
I'd express it in a somewhat different way: the view of the Python
community is that language-inforced access restrictions are useless and
annoying, IOW an unnecessary pain. Which doesn't imply that messing with
implementation of other modules is actually *encouraged*. Having the
possibility to easily do so is quite handy when that's the only/less
worse solution, but is not a recommended approach in general.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb@xiludom. gro'.split('@')])"
Antoon Pardon wrote:
On 2006-07-21, fuzzylollipop <jarrod.roberso n@gmail.comwrot e:
>
>
>
Why do you assume that in my example the other module is
not understood?
>
>>Antoon Pardon wrote:
>>
>>
>>
>>you don't understand what "implementa tion detail" means, it means it is
>>NOT part of the public API and no client code should ever use it.
>>
>>If you reference _vara in your code and it is in someone elses module
>>you don't understand YOU ARE NOT SUPPOSED TO DO THAT!
>>
>>
>>>Suppose I am writing my own module, I use an underscore, to
>>>mark variables which are an implementation detail for my
>>>module.
>>>
>>>Now I need to import an other module in my module and need access
>>>to an implementation variable from that module. So now I have
>>>variables with an underscore which have two different meanings:
>>>mark variables which are an implementation detail for my
>>>module.
>>>
>>>Now I need to import an other module in my module and need access
>>>to an implementation variable from that module. So now I have
>>>variables with an underscore which have two different meanings:
>>you don't understand what "implementa tion detail" means, it means it is
>>NOT part of the public API and no client code should ever use it.
>>
>>If you reference _vara in your code and it is in someone elses module
>>you don't understand YOU ARE NOT SUPPOSED TO DO THAT!
>
Why do you assume that in my example the other module is
not understood?
fuzzylollipop meant !-)
Hint : add a comma at the right place so parsing is unambigous:
"""
If you reference _vara in your code and it is in someone elses module,
you don't understand YOU ARE NOT SUPPOSED TO DO THAT!
"""
>
>>
>>Users of your module should NEVER KNOW any of the _ or __ stuff exists
>>to begin with.
>>
>>
>>
>>You should NEVER use it.
>
>
Well that may be your view, but AFAICS it is not the view of
the python community. Because each time some mechanism is
proposed for real private variable, people oppose it, they
want people to have access to what are supposed to be
private variables.
>> 1) This is an implemantation detail of this module, It is the
>> users of my module who have to be extra carefull using it.
>> users of my module who have to be extra carefull using it.
>>Users of your module should NEVER KNOW any of the _ or __ stuff exists
>>to begin with.
>>
>>
>> 2) This is an implemantation detail of the other module,
>> I should be extra carefull using it.
>> I should be extra carefull using it.
>>You should NEVER use it.
>
Well that may be your view, but AFAICS it is not the view of
the python community. Because each time some mechanism is
proposed for real private variable, people oppose it, they
want people to have access to what are supposed to be
private variables.
community is that language-inforced access restrictions are useless and
annoying, IOW an unnecessary pain. Which doesn't imply that messing with
implementation of other modules is actually *encouraged*. Having the
possibility to easily do so is quite handy when that's the only/less
worse solution, but is not a recommended approach in general.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb@xiludom. gro'.split('@')])"
Comment