Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-12 Thread Steven D'Aprano
Thomas Wouters wrote: I would much rather loudly warn people to fix their code, instead of forcing other implementations (and, more importantly to me personally, future CPython changes :) to deal with the distinction forever. But if we declare a wrapper to be the right way to deal with this, let

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-12 Thread Terrence Cole
On Sat, 2011-03-12 at 12:49 +1300, Greg Ewing wrote: > Thomas Wouters wrote: > > > 2. Make CFunctions turn into methods in CPython (after a period of > > warning about the impending change, obviously.) The actual *usecase* for > > this is hard to envision > > While not necessary for the case b

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-12 Thread Thomas Wouters
On Sat, Mar 12, 2011 at 17:08, Greg Ewing wrote: > Guido van Rossum wrote: > > IIUC Thomas found that this breaks some current use of staticmethod. >> > > I*I*UC, it wasn't making it callable that was the problem, > it was changing the behaviour so that the staticmethod > wrapper returns itself i

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-12 Thread Greg Ewing
Guido van Rossum wrote: IIUC Thomas found that this breaks some current use of staticmethod. I*I*UC, it wasn't making it callable that was the problem, it was changing the behaviour so that the staticmethod wrapper returns itself instead of the underlying object when accessed as a descriptor.

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-11 Thread Steven D'Aprano
Guido van Rossum wrote: +1 on making staticmethods callable. I would have found that useful in the past. IIUC Thomas found that this breaks some current use of staticmethod. As I understand it, Thomas found that having staticmethod callable AND have staticmethod.__get__ return self breaks

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-11 Thread Nick Coghlan
On Fri, Mar 11, 2011 at 10:48 PM, Guido van Rossum wrote: >> +1 on making staticmethods callable. I would have found that useful in the >> past. > > IIUC Thomas found that this breaks some current use of staticmethod. >From his first post, I understood the compatibility issue to more be the fact

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-11 Thread Guido van Rossum
On Fri, Mar 11, 2011 at 10:09 PM, Steven D'Aprano wrote: > Thomas Wouters wrote: >> >> One of the things brought up at the language summit (and I believe at the >> VM >> summit, although I wasn't there) was the unpredictable behaviour of >> callables turning into methods when they're class attribu

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-11 Thread Steven D'Aprano
Thomas Wouters wrote: One of the things brought up at the language summit (and I believe at the VM summit, although I wasn't there) was the unpredictable behaviour of callables turning into methods when they're class attributes. [...] 1. Make staticmethod a callable object directly (it isn't,

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-11 Thread Guido van Rossum
On Fri, Mar 11, 2011 at 6:49 PM, Greg Ewing wrote: > Thomas Wouters wrote: > >>  2. Make CFunctions turn into methods in CPython (after a period of >> warning about the impending change, obviously.) The actual *usecase* for >> this is hard to envision > > While not necessary for the case being dis

Re: [Python-Dev] Callable, non-descriptor class attributes.

2011-03-11 Thread Greg Ewing
Thomas Wouters wrote: 2. Make CFunctions turn into methods in CPython (after a period of warning about the impending change, obviously.) The actual *usecase* for this is hard to envision While not necessary for the case being discussed here, this would be a big help for Pyrex and Cython, whe

[Python-Dev] Callable, non-descriptor class attributes.

2011-03-11 Thread Thomas Wouters
One of the things brought up at the language summit (and I believe at the VM summit, although I wasn't there) was the unpredictable behaviour of callables turning into methods when they're class attributes. Specifically, things that are CFunctions in CPython (builtin functions, which are not descri