Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Fredrik Lundh
Talin wrote: >> brushing off a carefully thought out design and the process that led >> up to it with "it's just like picking between two random colors" is a >> pretty direct way of saying that you consider yourself so much smarter >> than the people involved that you don't even care about what

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Fredrik Lundh
Phillip J. Eby wrote: >> (but I'm suspect that my view of "generics" is somewhat different from >> Phillips, so let's focus on fully understanding his proposal first) > > So now I'm curious. Me too. Let me see if I can figure out what it is, well enough to write it down. > Maybe it's better.

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Thomas Lotze
Guido van Rossum wrote: >> I'm sure you're aware about it, but in Zope 3 terminology, these are >> 'provide' and 'implement', respectively. > > I like provide, but I'm not so sure about implement, since it is awfully > ambiguous -- most of the time it is the class that does the implementing. > Th

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Fredrik Lundh
Bill Janssen wrote: >> Ow, that's the first time you describe this particular wrinkle. > > Yep. I hesitated to bring it up, but if there's a need for separate > namespaces for method names, why not do it right? what makes you so sure that Python's current design isn't "right" ? _

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Fredrik Lundh
Greg Ewing wrote: > Just as a matter of interest, how far do you > think these principles apply or don't apply > to more recent things like iter.next() that > don't follow this pattern? this has been discussed before, I think. googling for __next__ might bring up some python-dev discussions.

Re: [Python-3000] defop ?

2006-11-23 Thread Talin
Guido van Rossum wrote: > On 11/22/06, Calvin Spealman <[EMAIL PROTECTED]> wrote: >> This whole thing seems a bit off from start to finish. A seperate >> definition syntax with a special name/expression weirdo thingy, etc. > > I have the same gut feelings but find it hard to explain why. > > But

Re: [Python-3000] defop ?

2006-11-23 Thread Paul Moore
On 11/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 11/22/06, Calvin Spealman <[EMAIL PROTECTED]> wrote: > > This whole thing seems a bit off from start to finish. A seperate > > definition syntax with a special name/expression weirdo thingy, etc. > > I have the same gut feelings but find

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Paul Moore
On 11/23/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > So, the generic function 'as_string' here functions as an "interface" or > "ability". Of course, instead of being called 'as_string', it could live > as an attribute of the 'str' type, e.g. 'str.cast': OK, I think I just "clicked" with what

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread George Sakkis
On 11/23/06, Talin <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > George Sakkis wrote: > > > >> First off, I never implied someone's stupid just because we don't > >> happen to agree on everything. > > > > brushing off a carefully thought out design and the process that led > > up to it wit

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Gustavo Niemeyer
> Sure, but then there's no need for a formal framwork > for defining interfaces and adaptation -- by making > use of duck typing, the joint user of the two libraries > can wrap things as needed to make it all work. You can always do everything in another way, just like you don't need OO to be abl

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Gustavo Niemeyer
> > Consider 'iter()', for example, which can be viewed as adapting an > > object to the "iteration interface" and returning an object > > supporting iteration. > > An architecture astronaut might view it that way, but > I don't. To my way of thinking, iter(x) creates a new > object that iterates

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Gustavo Niemeyer
> I was under the impression that Zope's actual use cases for > instance-specific interfaces have mainly to do with *view* lookups and > other types of lookups that don't really come into the current > discussion scope as I understand it. That is, I thought that instance > interfaces were used pri

[Python-3000] Abilities / Interfaces

2006-11-23 Thread Dave Anderson
Proposal Summary Add 2 new keywords: implements, implement (alternatively, implements and implement can be implemented as object level functions) Add new built-in function: interface Add new object level function: does_implement Interfaces == There is a fight between u

[Python-3000] Abilities / Interfaces

2006-11-23 Thread Dave Anderson
Proposal Summary Add 2 new keywords: implements, implement (alternatively, implements and implement can be implemented as object level functions) Add new built-in function: interface Add new object level function: does_implement (with minor corrections in Implementation of Inter

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Gustavo Niemeyer
> IMO the difference between ABCs and interfaces/abilities is that > inserting a new ABC into an existing class hierarchy without modifying > its source code is considered a hack, and must be done by a helper > routine that *actually* mucks with __bases__; while (Zope-style) > interfaces use an ext

Re: [Python-3000] print() parameters in py3k

2006-11-23 Thread Fredrik Lundh
Barry Warsaw wrote: >> 2) for convenience, extend print to treat a format object as a format >> specifier for the following arguments: >> >> print (x, y, z, fmt="My X: %s, Your Y: %s, His Z: %s") >> >> becomes >> >> print(format("My X: %s, Your Y: %s, His Z: %s"), x, y ,z) >> >> 3) get r

Re: [Python-3000] print() parameters in py3k

2006-11-23 Thread Fredrik Lundh
Guido van Rossum wrote: > Hm. While not as obviously from a different universe as Barry's > proposal, this still pretty weird, probably at least from a different > planet (much farther than Iceland anyway :-) it's inspired by http://online.effbot.org/2006_11_01_archive.htm#et-builder which

Re: [Python-3000] print() parameters in py3k

2006-11-23 Thread Fredrik Lundh
George Sakkis wrote: > a. Will print have to do an isinstance(args[0], format) to decide what > to do ? If so, don't the usual arguments for duck typing and against > type checking apply here ? isinstance (or an equivalent mechanism) would be more robust, in this specific case. > b. print(a,b,c)

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Aahz
On Wed, Nov 22, 2006, Talin wrote: > > While I wouldn't say it quite so strongly, I do think that there is a > great deal of subjectivity in HCI discussions. One person's 'intuitive' > may be another person's 'orange smoke', as we've seen in the current > discussion. But the whole point of maki

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread George Sakkis
On 11/23/06, Aahz <[EMAIL PROTECTED]> wrote: > On Wed, Nov 22, 2006, Talin wrote: > > > > While I wouldn't say it quite so strongly, I do think that there is a > > great deal of subjectivity in HCI discussions. One person's 'intuitive' > > may be another person's 'orange smoke', as we've seen in t

Re: [Python-3000] Fwd: defop ?

2006-11-23 Thread Guido van Rossum
On 11/22/06, Calvin Spealman <[EMAIL PROTECTED]> wrote: > On 11/22/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Not sure I like this better. My spelling of "operator::XXX" is > > "__XXX__" and I like that just fine -- no new syntax needed. > > Well, that might be a spelling of `operator::XXX

Re: [Python-3000] print() parameters in py3k

2006-11-23 Thread Guido van Rossum
Let me just say -1 on this idea so we can close the thread. None of that convinces me. I don't think that print(a, b) failing when b has a certain unexpected type can be considered consistent. The ElementBuilder example doesn't apply because it takes very limited argument types (string, dict, E; e

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Guido van Rossum
Smells a bit like the rejected PEP 245 doesn't it? You should at least explain how it differs in a summary or rationale. Anyway, it's Thanksgiving day here, and I'm unlikely to be able to spend much time on this collection of threads until Monday or so... And even then I'll have other work to do -

[Python-3000] Generic functions vs. OO

2006-11-23 Thread Guido van Rossum
I'm reposting this under a different subject because the other subject seems to have gone off on a tangent. The rest are Phillip's words. --Guido -- Forwarded message -- From: Phillip J. Eby <[EMAIL PROTECTED]> Date: Nov 22, 2006 10:01 PM Subject: Re: [Python-3000] Special methods

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Paul Moore
On 11/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I'm reposting this under a different subject because the other subject > seems to have gone off on a tangent. The rest are Phillip's words. [...] OK, I've read and tried to digest this. It looks good. The one thing I'm still not getting, a

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Bill Janssen
> > I don't know anything by CLOS. > > I'll drop off a copy of the book on Monday. Lord knows we have > zillions of extra copies floating around PARC. I'll still drop off a copy (of Common Lisp the Language, version 2), but there's no need to wait. It's on the Web at http://www.supelec.fr/docs/

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Phillip J. Eby
At 05:55 PM 11/23/2006 +, Paul Moore wrote: >On 11/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > I'm reposting this under a different subject because the other subject > > seems to have gone off on a tangent. The rest are Phillip's words. >[...] > >OK, I've read and tried to digest thi

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Phillip J. Eby
At 10:14 AM 11/23/2006 -0200, Gustavo Niemeyer wrote: >This is true for generic functions as well, except that >instead of using an IFruit interface, you have a fruit() >generic function which handles the adaptation. Unfortunately, >this model doesn't work with more complex hierachies. You've got

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Bill Janssen
> Bill Janssen wrote: > > >> Ow, that's the first time you describe this particular wrinkle. > > > > Yep. I hesitated to bring it up, but if there's a need for separate > > namespaces for method names, why not do it right? > > what makes you so sure that Python's current design isn't "right" ?

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Guido van Rossum
On 11/23/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 05:55 PM 11/23/2006 +, Paul Moore wrote: > >On 11/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > I'm reposting this under a different subject because the other subject > > > seems to have gone off on a tangent. The rest are P

[Python-3000] optional argument annotations

2006-11-23 Thread Tony Lownds
I have a working optional argument syntax implementation, I'm hoping to get some direction on the implementation decisions so far please see below. Python 3.0x (p3yk:52824M, Nov 23 2006, 09:22:23) [GCC 3.4.4 20050721 (Red Hat 3.4.4-2)] on linux2 Type "help", "copyright", "credits" or "licens

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Guido van Rossum
On 11/22/06, Thomas Lotze <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > >> I'm sure you're aware about it, but in Zope 3 terminology, these are > >> 'provide' and 'implement', respectively. > > > > I like provide, but I'm not so sure about implement, since it is awfully > > ambiguous --

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Phillip J. Eby
At 10:53 AM 11/23/2006 -0800, Guido van Rossum wrote: >On 11/22/06, Thomas Lotze <[EMAIL PROTECTED]> wrote: > > Guido van Rossum wrote: > > > > >> I'm sure you're aware about it, but in Zope 3 terminology, these are > > >> 'provide' and 'implement', respectively. > > > > > > I like provide, but I'm

Re: [Python-3000] optional argument annotations

2006-11-23 Thread Phillip J. Eby
At 10:00 AM 11/23/2006 -0800, Tony Lownds wrote: >I have a working optional argument syntax implementation, I'm hoping >to get some direction on >the implementation decisions so far please see below. Why not just have the generated bytecode construct the annotation dictionary directly and ass

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Phillip J. Eby
At 10:43 AM 11/23/2006 -0800, Guido van Rossum wrote: >Changing the class can't add fields to the C struct that represent the >object (since that would mean realloc()'ing the object and hence >potentially changing its address). So why not make this a capability >of the base function type, rather th

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Gustavo Niemeyer
> At 10:14 AM 11/23/2006 -0200, Gustavo Niemeyer wrote: > >This is true for generic functions as well, except that > >instead of using an IFruit interface, you have a fruit() > >generic function which handles the adaptation. Unfortunately, > >this model doesn't work with more complex hierachies. >

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Gustavo Niemeyer
(...) > A few important points here: > > 1. A basic interface mechanism is extemely simple to implement, given > generic functions (...) All of these points are completely true for interfaces implemented without generic functions. In fact, I fail to recognize in your mail a reason why generic fu

Re: [Python-3000] optional argument annotations

2006-11-23 Thread Tony Lownds
On Nov 23, 2006, at 11:21 AM, Phillip J. Eby wrote: > Why not just have the generated bytecode construct the annotation > dictionary directly and assign it to the returned function's > func_annotations, and the same for func_return if needed? Then > there'd be no need to change the MAKE_FU

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Greg Ewing
Guido van Rossum wrote: > Your presence here has been entirely a distraction. That's a troll to me. Steady on, Guido. Trolling is making deliberately inflammatory statements with the intention of stirring up controversy. That's a pretty heavy accusation to make. You're effectively saying he's sett

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Phillip J. Eby
At 06:14 PM 11/23/2006 -0200, Gustavo Niemeyer wrote: >(...) > > A few important points here: > > > > 1. A basic interface mechanism is extemely simple to implement, given > > generic functions >(...) > >All of these points are completely true for interfaces implemented >without generic functions.

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Phillip J. Eby
At 03:54 PM 11/23/2006 -0500, Phillip J. Eby wrote: >5. Generic functions are easily grasped as a dynamic version of overloading >as seen in other languages (including C#, Java, C++, etc., where there's no >built-in notion of "adaptation") Oh, and I forgot: they're also easily understood as generi

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Paul Moore
On 11/23/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 05:55 PM 11/23/2006 +, Paul Moore wrote: > >On 11/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > I'm reposting this under a different subject because the other subject > > > seems to have gone off on a tangent. The rest are P

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Greg Ewing
Gustavo Niemeyer wrote: > If you have an adapter from Apple to IFruit, any user > requiring an IFruit interface for an object will be > able to obtain it from Apple instances. The "automatically" > part is not quite true, as adaptation must be explicitly > requested. Yes, and that's where it fal

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Phillip J. Eby
At 09:53 PM 11/23/2006 +, Paul Moore wrote: >OK. So under your proposal, all Python functions are (potentially) >generic, and addmethod is how you add extra overloads? (And hasmethod >is pretty obvious, and defop AFAICT is a syntax for addmethod, is that >right?) > >Did I get that right? Yes,

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Gustavo Niemeyer
> Yes, and that's where it falls down, as far as I can > see. It's not just that it's "not quite" automatic, > it's almost completely *non*-automatic. Given that, > I see little benefit in having a formal mechanism > for it. I don't see your point here. Are you arguing that pretty much every appr

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Greg Ewing
Gustavo Niemeyer wrote: > Are you arguing that > pretty much every approach being discussed is bad and > we should instead implement something magically > transforming types? No, I'm questioning the need to do anything at all. I don't see a big problem that merits a heavyweight solution like a for

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Greg Ewing
Guido van Rossum wrote: > I fear I will miss the class as a convenient focus for > related functionality. I have the same feeling. I get the impression that generic functions work okay in a language designed around them from the beginning. But adding them belatedly to a language built around class

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Greg Ewing
Phillip J. Eby wrote: > Calling people names isn't particularly conducive to a technical > discussion... Sorry, I didn't mean it to sound that way. I was just making reference to a concept elucidated elsewhere -- invoking an "argument pattern", so to speak.-) What I'm saying is that, because th

Re: [Python-3000] optional argument annotations

2006-11-23 Thread Guido van Rossum
On 11/23/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > I have a working optional argument syntax implementation, I'm hoping > to get some direction on > the implementation decisions so far please see below. Wow! > Python 3.0x (p3yk:52824M, Nov 23 2006, 09:22:23) > [GCC 3.4.4 20050721 (Red Hat

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Guido van Rossum
On 11/23/06, Bill Janssen <[EMAIL PROTECTED]> wrote: > > > I don't know anything by CLOS. > > > > I'll drop off a copy of the book on Monday. Lord knows we have > > zillions of extra copies floating around PARC. > > I'll still drop off a copy (of Common Lisp the Language, version 2), > but there's

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Guido van Rossum
I'll give you that it may not have been intentional. But the effect is the same. And I felt rather offended by his offhand rejection of "most HCI arguments" -- in my view sarcasm is quite a bit more acceptable than insult. I stick to my point that he is lacking essential social skills for effective

Re: [Python-3000] Generic functions vs. OO

2006-11-23 Thread Guido van Rossum
Phillip J. Eby wrote: > At 08:29 PM 11/22/2006 -0800, Guido van Rossum wrote: > >One thing that rubs me the wrong way about generic functions is that > >it appears to go against OO. Now I'm not someone to take OO as > >religion, but there's something uncomfortable (for me) about how, in > >Phillip'

Re: [Python-3000] Special methods and interface-based type system

2006-11-23 Thread Fredrik Lundh
Bill Janssen wrote: > I think method namespaces are already OK; the question is > whether to move these specially-named (for whatever reason) > methods to a real namespace (a dict somewhere) where "somewhere" is exactly where? how do I add things to that namespace? how do I specify what names

Re: [Python-3000] Abilities / Interfaces

2006-11-23 Thread Ron Adam
Greg Ewing wrote: > Gustavo Niemeyer wrote: >> Are you arguing that >> pretty much every approach being discussed is bad and >> we should instead implement something magically >> transforming types? > > No, I'm questioning the need to do anything at all. > I don't see a big problem that merits a h