Steven D'Aprano a écrit :
(snip)
But it's quite rare to see double-underscore really private attributes
in Python code. It is considered to go against the spirit of the language.
Not necessarily against the spirit - it's mostly than __name_mangling
is only really useful when you want to
On Aug 24, 7:12 pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
On Sun, 24 Aug 2008 12:28:53 +0200, Peter Otten wrote:
Hussein B wrote:
I noted that Python encourage the usage of: --
obj.prop = data
x = obj.prop
--
to set/get an object's property value. What if I want
On Aug 25, 4:56 pm, Hussein B [EMAIL PROTECTED] wrote:
AFAIUY (understand you), what it is called a property in Java, it is
called an attribute in Python?
Why Python encourages direct access to object's attributes?
The simplest answer is Because Python is not Java :)
Speaking of which, have
On Sun, 24 Aug 2008 23:56:27 -0700, Hussein B wrote:
On Aug 24, 7:12 pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
I noted that Python encourage the usage of: -- obj.prop = data
x = obj.prop
--
to set/get an object's property value. What if I want to run some
logic
On Aug 25, 4:31 am, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Sun, 24 Aug 2008 23:56:27 -0700, Hussein B wrote:
On Aug 24, 7:12 pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
I noted that Python encourage the usage of: -- obj.prop = data
x = obj.prop
--
to
Hey,
I noted that Python encourage the usage of:
--
obj.prop = data
x = obj.prop
--
to set/get an object's property value.
What if I want to run some logic upon setting/getting a property?
What is Python preferred method to do so (using the new feature
'property')?
I don't think __getattr__ and
Hussein B wrote:
I noted that Python encourage the usage of:
--
obj.prop = data
x = obj.prop
--
to set/get an object's property value.
What if I want to run some logic upon setting/getting a property?
What is Python preferred method to do so (using the new feature
'property')?
I don't
On Aug 24, 5:28 am, Peter Otten [EMAIL PROTECTED] wrote:
Hussein B wrote:
I noted that Python encourage the usage of:
--
obj.prop = data
x = obj.prop
--
to set/get an object's property value.
What if I want to run some logic upon setting/getting a property?
What is Python
On Aug 24, 5:07 am, Hussein B [EMAIL PROTECTED] wrote:
Hey,
I noted that Python encourage the usage of:
--
obj.prop = data
x = obj.prop
--
to set/get an object's property value.
What if I want to run some logic upon setting/getting a property?
What is Python preferred method to do so
On Sun, 24 Aug 2008 12:28:53 +0200, Peter Otten wrote:
Hussein B wrote:
I noted that Python encourage the usage of: --
obj.prop = data
x = obj.prop
--
to set/get an object's property value. What if I want to run some logic
upon setting/getting a property? What is Python preferred method
10 matches
Mail list logo