Re: [Python-3000] Implementations: A syntax for extending method dispatching beyond type/class inheritance

2006-12-06 Thread Dave Anderson
on 12/3/2006 7:54 PM Bill Janssen wrote: >> Implementations are used to make Method Dispatching more flexible by >> allowing a class to claim that it acts like another class/type even >> though it is not derived from that class/type. > > I'm not sure just what this adds over the simple "change_

Re: [Python-3000] [Fwd: features i'd like [Python 3000] ... #3: fix super()]

2006-12-06 Thread Bill Janssen
> I agree with you, but it makes it *very* difficult to write properly > behaving cooperative super calls. In fact, if one inherits at any point > from object, one must necessarily use the following pattern in every > class: > > try: > _method = super(cls, obj).method > except AttributeError:

Re: [Python-3000] [Fwd: features i'd like [Python 3000] ... #3: fix super()]

2006-12-06 Thread Josiah Carlson
"Thomas Wouters" <[EMAIL PROTECTED]> wrote: > On 12/6/06, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > "Thomas Wouters" <[EMAIL PROTECTED]> wrote: > > > You forget that that's actually what super() is for. It does the right > > thing > > > in the case of MI (and every other case, in fact :-) > >

Re: [Python-3000] [Fwd: features i'd like [Python 3000] ... #3: fix super()]

2006-12-06 Thread Thomas Wouters
On 12/6/06, Josiah Carlson <[EMAIL PROTECTED]> wrote: "Thomas Wouters" <[EMAIL PROTECTED]> wrote: > On 12/6/06, Jan Grant <[EMAIL PROTECTED]> wrote: > > On Mon, 4 Dec 2006, Ben Wing wrote: > > > > > as a result, i imagine there's a strong urge to just hardcode the name > > > of the parent > >

Re: [Python-3000] [Fwd: features i'd like [Python 3000] ... #3: fix super()]

2006-12-06 Thread Josiah Carlson
"Thomas Wouters" <[EMAIL PROTECTED]> wrote: > On 12/6/06, Jan Grant <[EMAIL PROTECTED]> wrote: > > On Mon, 4 Dec 2006, Ben Wing wrote: > > > > > as a result, i imagine there's a strong urge to just hardcode the name > > > of the parent > > ^^ > > > > > -- super.meth(args) calls the su

Re: [Python-3000] Implementations: A syntax for extending method dispatching beyond type/class inheritance

2006-12-06 Thread Bill Janssen
> FWIW, Zope has a set of these things for sequences and mappings that > have stood up reasonably well (done as interfaces, but same idea). > See http://svn.zope.org/Zope3/trunk/src/zope/interface/common/ . > Maybe that can help your effort. Thanks, Gary. Interesting effort. I'll study i

Re: [Python-3000] Implementations: A syntax for extending method dispatching beyond type/class inheritance

2006-12-06 Thread Gary Poster
On Dec 6, 2006, at 2:09 PM, Bill Janssen wrote: ...an argument that I appreciate, even though it mixes use cases for implementation and documentation in a way that I personally don't care for. That's fine. You conclude: > Another > problem is that the basic Python types are somewhat poorly u

Re: [Python-3000] iostack and Oh Oh

2006-12-06 Thread Guido van Rossum
On 12/6/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > I would also like to point out again, though, that the mechanism I've > proposed (wrapping generic functions to create interfaces) actually > supports (or can be made to support, using appropriate convenience > functions) all the use cases tha

Re: [Python-3000] [Fwd: features i'd like [Python 3000] ... #3: fix super()]

2006-12-06 Thread Thomas Wouters
On 12/6/06, Jan Grant <[EMAIL PROTECTED]> wrote: On Mon, 4 Dec 2006, Ben Wing wrote: > as a result, i imagine there's a strong urge to just hardcode the name > of the parent ^^ > -- super.meth(args) calls the superclass method `meth' ^^ Pyt

Re: [Python-3000] iostack and Oh Oh

2006-12-06 Thread Phillip J. Eby
At 02:58 PM 12/6/2006 -0600, Guido van Rossum wrote: >On 12/5/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > > At 09:59 AM 12/5/2006 -0600, Guido van Rossum wrote: > > >My point is that an interface can *document* (at least in English) a > > >"contract" about the invariants between operations. Whi

Re: [Python-3000] iostack and Oh Oh

2006-12-06 Thread Guido van Rossum
On 12/5/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 09:59 AM 12/5/2006 -0600, Guido van Rossum wrote: > >My point is that an interface can *document* (at least in English) a > >"contract" about the invariants between operations. While I'm not into > >enforcing or verifying such contracts, I'

Re: [Python-3000] Implementations: A syntax for extending method dispatching beyond type/class inheritance

2006-12-06 Thread Bill Janssen
> Compared to ABCs, interfaces can also describe contracts that can be > fulfilled with any object--not just class instances, but classes > themselves, and functions. Sure, and I appreciate that. But classes and functions are both instances of types, and thus can have extra types mixed into t

Re: [Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Jan Grant
On Wed, 6 Dec 2006, Barry Warsaw wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Dec 6, 2006, at 5:24 AM, Jan Grant wrote: > > > PS. IF generic functions (operators) could be sensitive to return types > > and IF python6k supported a complex type inference mechanism (possibly > >

Re: [Python-3000] Changing the % format return type Re: features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Josiah Carlson
Jan Grant <[EMAIL PROTECTED]> wrote: > On Wed, 6 Dec 2006, Jan Grant wrote: > > > def foo(d: sqlDriver): > > s = "select template goes here" % (param1, param2) > > r = d.query(s)# do the Right Thing > > Suppose for a moment that % used like this returns, not a string, but an > object th

Re: [Python-3000] Implementations: A syntax for extending method dispatching beyond type/class inheritance

2006-12-06 Thread Gary Poster
On Dec 6, 2006, at 4:20 AM, Jan Grant wrote: > On Mon, 4 Dec 2006, Bill Janssen wrote: >> Jim Jewett writes: ... >>> (1) Interfaces can be placed on a separate (presumably light- >>> weight) >>> inheritance hierarchy. ... >> And I don't really >> see how it's lighter-weight -- can you explain t

Re: [Python-3000] interpolated strings

2006-12-06 Thread Antoine
> (people who do interpolation tend to expect dynamic lexical scoping, not > static > object binding...) After thinking a bit about it, you are right. Or more precisely, "inline" interpolation with literals is mainly useful for quick-and-dirty scripts rather than full-blown apps. (this "quick-an

Re: [Python-3000] interpolated strings

2006-12-06 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 6, 2006, at 7:04 AM, Fredrik Lundh wrote: > btw, note that you can get the same behaviour with today's Python: > > s = I("some string here with ", variable, " in it") > Or even s = I('some string here with $variable in it') or some day

Re: [Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 6, 2006, at 5:24 AM, Jan Grant wrote: > PS. IF generic functions (operators) could be sensitive to return > types > and IF python6k supported a complex type inference mechanism (possibly > including automatic coercion), then one might be able

Re: [Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 6, 2006, at 5:02 AM, Ka-Ping Yee wrote: I agree with where Ka-Ping is headed... > Where does this design constraint take us? > > One possibility it suggests is that the interpolation function could > be generic, allowing the formatting templat

Re: [Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 6, 2006, at 4:36 AM, Jan Grant wrote: > On Mon, 4 Dec 2006, Barry Warsaw wrote: > >> After several years of use, I'm strongly +1 for this feature in some >> form or another. > > I think it's a terrible idea in almost every form. > >> There shou

Re: [Python-3000] interpolated strings

2006-12-06 Thread Fredrik Lundh
Antoine wrote: > s = i"some string here with {variable} in it" > > The Interpolation object captures the format string, as well as a dict of > the needed variables from the current locals and globals (here, the > "variable"). I'm not sure I can think of a way to explain to a new Python programmer

Re: [Python-3000] interpolated strings

2006-12-06 Thread Antoine
> Or perhaps simpler, a new kind of string literal would construct an > Interpolation object: Hmm, so Jan proposed something similar in the meantime. Sorry for the noise. ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mail

Re: [Python-3000] interpolated strings

2006-12-06 Thread Antoine
> On Wed, 6 Dec 2006, Ka-Ping Yee wrote: > and "%" is overloadable on the basis that the return type is determined > to be compatible with "some_type_that_signals_sql_interpolation". Those > are some mighty big "IF"s though, and you could still concoct cases > where things would break :-) Or perha

[Python-3000] Changing the % format return type Re: features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Jan Grant
Ka-Ping Yee's suggestion of overriding the interpolation builtin (or let's say, the "%" operator used for formatting) means there might be another way to do this using GFs: let's say that the following illustrative snippet is still desirable - On Wed, 6 Dec 2006, Jan Grant wrote: > def foo(d:

Re: [Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Jan Grant
On Wed, 6 Dec 2006, Ka-Ping Yee wrote: [well-articulated point made] Thank-you: I agree with pretty much everything you say. It's an interesting question to ask, "can one construct a convenient interpolation mechanism that uses the appropriate application quoting mechanisms where necessary?"

Re: [Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Ka-Ping Yee
On Wed, 6 Dec 2006, Jan Grant wrote: [regarding string interpolation] > I think it's a terrible idea in almost every form. [...] > The reason _why_ I think it's such a bad idea is the above statement > just doesn't gel with practical experience. Google will find plenty of > reading material if you

Re: [Python-3000] [Fwd: features i'd like [Python 3000] ... #3: fix super()]

2006-12-06 Thread Jan Grant
On Mon, 4 Dec 2006, Ben Wing wrote: > as a result, i imagine there's a strong urge to just hardcode the name > of the parent ^^ > -- super.meth(args) calls the superclass method `meth' ^^ Python supports multiple inheritance, unlike Java; the

Re: [Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-06 Thread Jan Grant
On Mon, 4 Dec 2006, Barry Warsaw wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Dec 4, 2006, at 5:08 AM, Ben Wing wrote: > > > i see in PEP 3101 that there's some work going on to fix up the string > > formatting capabilities of python. it looks good to me but it still > > does

Re: [Python-3000] Implementations: A syntax for extending method dispatching beyond type/class inheritance

2006-12-06 Thread Jan Grant
On Mon, 4 Dec 2006, Bill Janssen wrote: > Jim Jewett writes: > > On 12/3/06, Bill Janssen <[EMAIL PROTECTED]> wrote: > > > > Implementations are used to make Method Dispatching more flexible by > > > > allowing a class to claim that it acts like another class/type even > > > > though it is not der