Patrick Maupin wrote:
Actually, I think I overstated my case -- there is some special logic
for len and built-in objects, I think.
Yes, len() invokes the C-level sq_len slot of the type object,
which for built-in types points directly to the C function
implementing the len() operation for that
On Mar 18, 12:11 am, Patrick Maupin wrote:
> On Mar 17, 5:34 pm, Joaquin Abian wrote:
>
>
>
> > On Mar 17, 3:43 pm, Patrick Maupin wrote:
>
> > > On Mar 17, 4:12 am, Bruno Desthuilliers
> > > 42.desthuilli...@websiteburo.invalid> wrote:
> > > > Patrick Maupin a écrit :
>
> > > > > On Mar 16, 1:
On Mar 17, 5:34 pm, Joaquin Abian wrote:
> On Mar 17, 3:43 pm, Patrick Maupin wrote:
>
>
>
> > On Mar 17, 4:12 am, Bruno Desthuilliers
> > 42.desthuilli...@websiteburo.invalid> wrote:
> > > Patrick Maupin a écrit :
>
> > > > On Mar 16, 1:59 pm, Jason Tackaberry wrote:
> > > >> Why not create th
On Mar 17, 3:43 pm, Patrick Maupin wrote:
> On Mar 17, 4:12 am, Bruno Desthuilliers
> 42.desthuilli...@websiteburo.invalid> wrote:
> > Patrick Maupin a écrit :
>
> > > On Mar 16, 1:59 pm, Jason Tackaberry wrote:
> > >> Why not create the bound methods at instantiation time, rather than
> > >> us
On Mar 17, 2:55 pm, Terry Reedy wrote:
> On 3/17/2010 1:35 AM, Patrick Maupin wrote:
>
> def a(s, count, lenfunc):
> > ... for i in xrange(count):
> > ... z = lenfunc(s)
> > ...
> >>> a('abcdef', 1, len)
> >>> a('abcdef', 1, str.__len__)
> > Running cPyt
On 3/17/2010 1:35 AM, Patrick Maupin wrote:
def a(s, count, lenfunc):
... for i in xrange(count):
...z = lenfunc(s)
...
>>> a('abcdef', 1, len)
>>> a('abcdef', 1, str.__len__)
Running cPython 2.6 on my machine, len() runs about 3 times faster
than str.__len__().
Lie Ryan a écrit :
On 03/17/2010 08:12 PM, Bruno Desthuilliers wrote:
Patrick Maupin a écrit :
On Mar 16, 1:59 pm, Jason Tackaberry wrote:
Why not create the bound methods at instantiation time, rather than
using the descriptor protocol which has the overhead of creating a new
bound method ea
On Mar 17, 4:12 am, Bruno Desthuilliers wrote:
> Patrick Maupin a écrit :
>
> > On Mar 16, 1:59 pm, Jason Tackaberry wrote:
> >> Why not create the bound methods at instantiation time, rather than
> >> using the descriptor protocol which has the overhead of creating a new
> >> bound method each t
On 03/17/2010 08:12 PM, Bruno Desthuilliers wrote:
> Patrick Maupin a écrit :
>> On Mar 16, 1:59 pm, Jason Tackaberry wrote:
>>> Why not create the bound methods at instantiation time, rather than
>>> using the descriptor protocol which has the overhead of creating a new
>>> bound method each time
On 03/17/2010 04:32 PM, Steven D'Aprano wrote:
> On Wed, 17 Mar 2010 15:57:17 +1100, Lie Ryan wrote:
>
>> Most people probably would never need to use
>> descriptor protocol directly, since the immediate benefit of descriptor
>> protocol are property(), classmethod(), and instancemethod() decorato
Patrick Maupin a écrit :
On Mar 16, 1:59 pm, Jason Tackaberry wrote:
Why not create the bound methods at instantiation time, rather than
using the descriptor protocol which has the overhead of creating a new
bound method each time the method attribute is accessed?
Well, for one thing, Python
On Mar 16, 1:59 pm, Jason Tackaberry wrote:
> Why not create the bound methods at instantiation time, rather than
> using the descriptor protocol which has the overhead of creating a new
> bound method each time the method attribute is accessed?
Well, for one thing, Python classes are open. They
On Wed, 17 Mar 2010 15:57:17 +1100, Lie Ryan wrote:
> Most people probably would never need to use
> descriptor protocol directly, since the immediate benefit of descriptor
> protocol are property(), classmethod(), and instancemethod() decorators
> which, without descriptor protocol, would never b
On 03/17/2010 05:59 AM, Jason Tackaberry wrote:
> On Tue, 2010-03-16 at 10:04 +0100, Bruno Desthuilliers wrote:
>> Answer here:
>>
>> http://wiki.python.org/moin/FromFunctionToMethod
>
> I have a sense I used to know this once upon a time, but the question
> came to my mind (possibly again) and I
On Tue, Mar 16, 2010 at 2:04 AM, Bruno Desthuilliers
wrote:
> lallous a écrit :
>>
>> What is the difference between the reference in 'F' and 'func_tbl' ?
>
> Answer here:
>
> http://wiki.python.org/moin/FromFunctionToMethod
>
Among all the things in the Python language proper, this is probably
t
On Tue, 2010-03-16 at 10:04 +0100, Bruno Desthuilliers wrote:
> Answer here:
>
> http://wiki.python.org/moin/FromFunctionToMethod
I have a sense I used to know this once upon a time, but the question
came to my mind (possibly again) and I couldn't think of an answer:
Why not create the bound met
lallous a écrit :
Hello,
Learning Python from the help file and online resources can leave one
with many gaps. Can someone comment on the following:
(snip code)
Why in test1() when it uses the class variable func_tbl we still need
to pass self, but in test2() we don't ?
What is the differen
On Monday 15 March 2010 10:42:41 TomF wrote:
> On 2010-03-15 09:39:50 -0700, lallous said:
> >
> > Why in test1() when it uses the class variable func_tbl we still need
> > to pass self, but in test2() we don't ?
> >
> > What is the difference between the reference in 'F' and 'func_tbl' ?
>
On 2010-03-15 09:39:50 -0700, lallous said:
Hello,
Learning Python from the help file and online resources can leave one
with many gaps. Can someone comment on the following:
# -
class X:
T = 1
def f1(self, arg):
print "f1, arg=%d" % arg
def f2(self, arg):
Hello,
Learning Python from the help file and online resources can leave one
with many gaps. Can someone comment on the following:
# -
class X:
T = 1
def f1(self, arg):
print "f1, arg=%d" % arg
def f2(self, arg):
print "f2, arg=%d" % arg
def f3(self, arg):
20 matches
Mail list logo