Re: confused about the different built-in functions in Python

2014-05-26 Thread Terry Reedy
On 5/26/2014 4:32 PM, Marko Rauhamaa wrote: I stand corrected. I had thought the trampoline ("bound method object") was created once and for all. Assuming that bound methods are immutable, this is an implementation detail, either way. However, it is common for a specific method to be called

Re: confused about the different built-in functions in Python

2014-05-26 Thread Steven D'Aprano
On Mon, 26 May 2014 23:58:37 +0300, Marko Rauhamaa wrote: > Marko Rauhamaa : > >> Christian Heimes : >> >>> Python creates a new bound method object every time. A bound method >>> object is a callable object that keeps a strong reference to the >>> function, class and object. The bound method obj

Re: confused about the different built-in functions in Python

2014-05-26 Thread Gregory Ewing
Marko Rauhamaa wrote: IOW, you can override a method with setattr() but you cannot delete a method with delattr(). Actually, you can -- but you need to delete it from the class, not the instance: >>> delattr(X, 'f') >>> x.f() Traceback (most recent call last): File "", line 1, in Attribute

Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Marko Rauhamaa : > Christian Heimes : > >> Python creates a new bound method object every time. A bound method >> object is a callable object that keeps a strong reference to the >> function, class and object. The bound method object adds the object as >> first argument to the function (aka 'self'

Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Christian Heimes : > Python creates a new bound method object every time. A bound method > object is a callable object that keeps a strong reference to the > function, class and object. The bound method object adds the object as > first argument to the function (aka 'self'). I stand corrected. I

Re: confused about the different built-in functions in Python

2014-05-26 Thread Christian Heimes
On 26.05.2014 21:00, Marko Rauhamaa wrote: > Terry Reedy : > >> Part of the answer is Python's history. Up to about 2.1, most built-in >> types did not have methods, though I know lists did. Ints and strings >> did not, or chr and ord might have been int.chr() and str.ord(). (The >> current string

Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Terry Reedy : > Part of the answer is Python's history. Up to about 2.1, most built-in > types did not have methods, though I know lists did. Ints and strings > did not, or chr and ord might have been int.chr() and str.ord(). (The > current string methods were originally functions in the string >

Re: confused about the different built-in functions in Python

2014-05-26 Thread Terry Reedy
On 5/26/2014 11:15 AM, Deb Wyatt wrote: On 5/25/14 7:55 PM, Deb Wyatt wrote: I am confused about how various built-in functions are called. Some are called with dot notation How do you know/remember which way to call them? It can be confusing. Generally, built-in functions (like sum,

Re: confused about the different built-in functions in Python

2014-05-26 Thread Deb Wyatt
> > On 5/25/14 7:55 PM, Deb Wyatt wrote: >> I am confused about how various built-in functions are called. Some are >> called with dot notation >> >> How do you know/remember which way to call them? >> >> TIA, >> Deb in WA, USA > > It can be confusing. Generally, built-in functions (like sum

Re: confused about the different built-in functions in Python

2014-05-25 Thread Cameron Simpson
On 25May2014 15:55, Deb Wyatt wrote: I am confused about how various built-in functions are called. Some are called with dot notation each_item.isalpha() and some are called like 'normal' sum(numlist) How do you know/remember which way to call them? Documentation. However, some context:

Re: confused about the different built-in functions in Python

2014-05-25 Thread Ned Batchelder
On 5/25/14 7:55 PM, Deb Wyatt wrote: I am confused about how various built-in functions are called. Some are called with dot notation each_item.isalpha() and some are called like 'normal' sum(numlist) How do you know/remember which way to call them? TIA, Deb in WA, USA It can be confusing

confused about the different built-in functions in Python

2014-05-25 Thread Deb Wyatt
I am confused about how various built-in functions are called.  Some are called with dot notationeach_item.isalpha()and some are called like 'normal'sum(numlist)How do you know/remember which way to call them?TIA,Deb in WA, USA Free Online Photosharing - Share your photos online with your frie