Re: [Python-3000] interfaces

2006-11-19 Thread Greg Ewing
Antoine Pitrou wrote: > So to know if "deferred" was correctly used, I had to devise a test to > know if "timeout" is a number Another solution might have been to require it to be passed as a keyword (which will become easier if the proposal for keyword-only arguments gets in). -- Greg _

Re: [Python-3000] interfaces

2006-11-19 Thread Antoine Pitrou
Le dimanche 19 novembre 2006 à 12:44 -0500, George Sakkis a écrit : > I understand this is not the point you're trying to make, but in such > cases I usually prefer to make @decorator be equivalent to > @decorator() by something like: I could do that, but it's not very clean. Also it doesn't inva

Re: [Python-3000] interfaces

2006-11-19 Thread Mike Orr
On 11/19/06, George Sakkis <[EMAIL PROTECTED]> wrote: > That's perhaps one of the top gotchas in Python today; thankfully it > will change in 3.0. Until then, I can't see how one can avoid an > explicit check, either by testing with isinstance() or trying to call > an arbitrary method of the expect

Re: [Python-3000] interfaces

2006-11-19 Thread George Sakkis
On 11/19/06, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > I had the problem recently when I wrote a decorator which took an > optional number as an argument. The decorator declaration goes like > this: > > def deferred(timeout=None): > def decorate(func): > blah blah... > return dec

Re: [Python-3000] interfaces

2006-11-19 Thread Antoine Pitrou
Le samedi 18 novembre 2006 à 22:42 -0700, Neil Toronto a écrit : > Actually, plenty of people would dream of it and even do it. I've seen > some pretty evil implementations of Java interfaces. All they can > enforce is static types and method signatures. But protecting against erroneous use (ra

Re: [Python-3000] Interfaces for views and extended collections

2006-04-12 Thread Brett Cannon
On 4/11/06, Ian Bicking <[EMAIL PROTECTED]> wrote: > So Guido asked for more concrete discussion of things like views. A > richer set of collections also fits in here, as for instance dict.keys() > would be a view with a collection interface not exactly like other > collections. I wrote up some n

[Python-3000] Interfaces for views and extended collections

2006-04-11 Thread Ian Bicking
So Guido asked for more concrete discussion of things like views. A richer set of collections also fits in here, as for instance dict.keys() would be a view with a collection interface not exactly like other collections. I wrote up some notes, which I'll pass on. So, I can imagine 3 attribute

Re: [Python-3000] Interfaces (was: Re: Adaptation vs. Generic Functions)

2006-04-05 Thread Guido van Rossum
On 4/5/06, Ian Bicking <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > I have to write my slides for a talk about Py3K later today, but I'll > > be back. In the mean time I've rejected PEPs 245 and 246 in > > expectation of something better that's imminent! > > Is PEP 245 ("Python Interfac

[Python-3000] Interfaces (was: Re: Adaptation vs. Generic Functions)

2006-04-05 Thread Ian Bicking
Guido van Rossum wrote: > Fascinating ideas in this thread! It's certainly been interesting to see convergence coming from both directions independently. > I spent some time blogging about this on artima: > http://www.artima.com/weblogs/viewpost.jsp?thread=155123 > > I have to write my slides f