Terry Reedy wrote:
On 9/25/2012 4:07 PM, Ian Kelly wrote:
On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy tjre...@udel.edu wrote:
On 9/25/2012 11:03 AM, Chris Angelico wrote:
Instance attributes override (shadow) class attributes.
except for (some? all?) special methods
Those names
On Fri, Sep 28, 2012 at 12:02 PM, Prasad, Ramit
ramit.pra...@jpmorgan.com wrote:
Just to make sure I am following, if you call
foo.__len__() it goes to the instance code while
if you do len(foo) it will go to class.__len__()?
Yes:
class Foo(object):
... def __len__(self):
...
On 9/28/2012 2:02 PM, Prasad, Ramit wrote:
Just to make sure I am following, if you call
foo.__len__() it goes to the instance code while
if you do len(foo) it will go to class.__len__()?
len(foo) calls someclass.__len__(foo) where someclass is foo.__class__or
some superclass.
If so, why?
On Fri, 28 Sep 2012 18:02:04 +, Prasad, Ramit wrote:
Just to make sure I am following, if you call foo.__len__() it goes to
the instance code while if you do len(foo) it will go to
class.__len__()?
If you call foo.__len__, the attribute lookup of __len__ will use the
exact same search
On Sep 25, 11:41 pm, Jayden jayden.s...@gmail.com wrote:
Dear All,
In the Python Tutorial, Section 9.4, it is said that
Data attributes override method attributes with the same name.
But in my testing as follows:
#Begin
class A:
i = 10
def i():
print
Jayden wrote:
In the Python Tutorial, Section 9.4, it is said that
Data attributes override method attributes with the same name.
The tutorial is wrong here. That should be
Instance attributes override class attributes with the same name.
As methods are usually defined in the class and
On Sep 26, 12:08 am, Peter Otten __pete...@web.de wrote:
Jayden wrote:
In the Python Tutorial, Section 9.4, it is said that
Data attributes override method attributes with the same name.
The tutorial is wrong here. That should be
Instance attributes override class attributes with the
On Tue, 25 Sep 2012 06:41:43 -0700, Jayden wrote:
Dear All,
In the Python Tutorial, Section 9.4, it is said that
Data attributes override method attributes with the same name.
But in my testing as follows:
#Begin
class A:
i = 10
def i():
print 'i'
A.i
alex23 wrote:
On Sep 26, 12:08 am, Peter Otten __pete...@web.de wrote:
Jayden wrote:
In the Python Tutorial, Section 9.4, it is said that
Data attributes override method attributes with the same name.
The tutorial is wrong here. That should be
Instance attributes override class
On Wed, Sep 26, 2012 at 12:54 AM, Peter Otten __pete...@web.de wrote:
To me
Data attributes override method attributes with the same name
implies that data attributes take precedence over method attributes, not
that they replace them only when there is an assignment of data after the
method
Am 25.09.2012 16:11, schrieb alex23:
On Sep 26, 12:08 am, Peter Otten __pete...@web.de wrote:
Jayden wrote:
In the Python Tutorial, Section 9.4, it is said that
Data attributes override method attributes with the same name.
The tutorial is wrong here. That should be
Instance attributes
On 9/25/2012 11:03 AM, Chris Angelico wrote:
On Wed, Sep 26, 2012 at 12:54 AM, Peter Otten __pete...@web.de wrote:
To me
Data attributes override method attributes with the same name
implies that data attributes take precedence over method attributes, not
that they replace them only when
Am 25.09.2012 16:08 schrieb Peter Otten:
Jayden wrote:
In the Python Tutorial, Section 9.4, it is said that
Data attributes override method attributes with the same name.
The tutorial is wrong here. That should be
Instance attributes override class attributes with the same name.
I jump
On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy tjre...@udel.edu wrote:
On 9/25/2012 11:03 AM, Chris Angelico wrote:
Instance attributes override (shadow) class attributes.
except for (some? all?) special methods
Those names are shadowed too. If you call foo.__len__() and the name
is bound on
On 9/25/2012 10:54 AM, Peter Otten wrote:
alex23 wrote:
On Sep 26, 12:08 am, Peter Otten __pete...@web.de wrote:
Jayden wrote:
In the Python Tutorial, Section 9.4, it is said that
Data attributes override method attributes with the same name.
The tutorial is wrong here. That should be
On 9/25/2012 4:07 PM, Ian Kelly wrote:
On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy tjre...@udel.edu wrote:
On 9/25/2012 11:03 AM, Chris Angelico wrote:
Instance attributes override (shadow) class attributes.
except for (some? all?) special methods
Those names are shadowed too. If you
16 matches
Mail list logo