Re: built-in functions as class attributes

2008-12-08 Thread alex23
On Dec 8, 8:46 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > Here's a curiosity:  after > > def my_hex(x): >     return hex(x) > > one might expect hex and my_hex to be interchangeable > in most situations.  But (with both Python 2.x and 3.x) > I get: > > >>> def my_hex(x): return hex(x) > ... >

Re: built-in functions as class attributes

2008-12-08 Thread Mark Dickinson
On Dec 8, 11:23 am, Peter Otten <[EMAIL PROTECTED]> wrote: > I don't know if there is something official, I google for > > http://users.rcn.com/python/download/Descriptor.htm > > or "descrintro" every time I need a refresher. Thank you! I'd read this before, but apparently I'd either not taken it

Re: built-in functions as class attributes

2008-12-08 Thread Peter Otten
Mark Dickinson wrote: > Here's a curiosity: after > > def my_hex(x): > return hex(x) > > one might expect hex and my_hex to be interchangeable > in most situations. But (with both Python 2.x and 3.x) > I get: > def my_hex(x): return hex(x) > ... class T(object): f = hex > ... >>

built-in functions as class attributes

2008-12-08 Thread Mark Dickinson
Here's a curiosity: after def my_hex(x): return hex(x) one might expect hex and my_hex to be interchangeable in most situations. But (with both Python 2.x and 3.x) I get: >>> def my_hex(x): return hex(x) ... >>> class T(object): f = hex ... >>> class T2(object): f = my_hex ... >>> T().f(12