Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Talin
Mike Krell wrote: > On 5/11/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > >>I think I'm more comfortable with a maximal taxonomy. In a maximal >>taxonomy, I'd describe a large set of invariants, attributes, >>behavior, etc., and say e.g. "this is how a file behaves". A >>particular class can t

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Talin
Marcin 'Qrczak' Kowalczyk wrote: > Talin <[EMAIL PROTECTED]> writes: > > >> # Use as a function argument constraint >> @generic >> def flatten( x:concepts.iterable ): >> ... >> >> # Another overload >> @generic >> def flatten( x:concepts.associative ): > > How are concepts def

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Phillip J. Eby
At 02:50 PM 5/12/2006 +1200, Greg Ewing wrote: >These are large assumptions, which I suspect are at >least 87.43% wrong. Don't make the mistake of thinking >that everyone has the same preferences as you. And that's about 51.7% patronizing; don't make the mistake of thinking that my assumption was

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Greg Ewing
Phillip J. Eby wrote: > I meant only the shift from typing "def __iter__(" to "defop iter(", > irrespective of how it's implemented. On its own, that's no more than a syntax change, with very little to recommend it. With the associated semantics you propose, it's a very deep change indeed. > My

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Steven Bethard
On 5/11/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > In other words, I mean that if most people saw something like this in > "What's new in Python 3.0", I don't think they would freak out: > > """Removal of __magic__ attributes > > Special attribute names like '__iter__' have been replaced with

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Phillip J. Eby
At 11:39 AM 5/12/2006 +1200, Greg Ewing wrote: >Phillip J. Eby wrote: >>I'm only showing this example because I think getting rid of >>__magic_names__ for operations could be a good thing for readability, and >>it would remove an element of "magic" from today's Python. > >Although overloadable fu

Re: [Python-3000] Math in Python 3.0

2006-05-11 Thread Greg Ewing
Fredrik Johansson wrote: > Are people still positive regarding the idea of merging decimal and > binary floats into the same type? (Or at least ensuring that they can > be mixed seamlessly, Er, I thought Decimals were explicitly designed *not* to merge seamlessly with floats, so that one can't ac

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Marcin 'Qrczak' Kowalczyk
Talin <[EMAIL PROTECTED]> writes: ># Use as a function argument constraint >@generic >def flatten( x:concepts.iterable ): > ... > ># Another overload >@generic >def flatten( x:concepts.associative ): How are concepts defined? How is it determined which specializatio

Re: [Python-3000] i guess i was misunderstood

2006-05-11 Thread Greg Ewing
tomer filiba wrote: > b=B() # error, A.__init__ expects an instanc of A > > why is this kind of type-checking enforced by the language? Since type-class unification, there is no clear boundary between built-in and user-defined classes. Any class can potentially add C-level data to its instances

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Greg Ewing
Phillip J. Eby wrote: > I'm only showing this example because I think getting rid of > __magic_names__ for operations could be a good thing for readability, and > it would remove an element of "magic" from today's Python. Although overloadable functions are themselves somewhat magical, so this c

Re: [Python-3000] Questions on optional type annotations

2006-05-11 Thread Collin Winter
On 5/11/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Well, remember that the default use of type annotations is to ignore > them! You can write your own decorator that implements a specific > interpretation of the annotations, and you can make it do anything you > like. > > I think it would be

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Talin
Guido van Rossum python.org> writes: > The claim should be introspectable. *Conformance* to the claimed API > may be hard to introspect but IMO the claims should be introspectable, > separate from whatever we (think we) know about hasattr(). I sense convergence. Woot! :) Here's a rough sketch o

Re: [Python-3000] Math in Python 3.0

2006-05-11 Thread Raymond Hettinger
Fredrik Johansson wrote: > >Are people still positive regarding the idea of merging decimal and >binary floats into the same type? (Or at least ensuring that they can >be mixed seamlessly, which should be no problem with decimal literals >added to the language.) > IMO, the free mixing decimal an

Re: [Python-3000] Math in Python 3.0

2006-05-11 Thread Alex Martelli
On 5/11/06, Fredrik Johansson <[EMAIL PROTECTED]> wrote: ... > operators could be overloaded as well (to define mpf()+Decimal(), say) Actually, gmpy currently does it by monkeypatching decimal.Decimal (sigh) -- I believe that's only in the CVS HEAD, not yet in the released gmpy version (I'm not

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Mike Krell
On 5/11/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I think I'm more comfortable with a maximal taxonomy. In a maximal > taxonomy, I'd describe a large set of invariants, attributes, > behavior, etc., and say e.g. "this is how a file behaves". A > particular class can then claim to be a file

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Guido van Rossum
On 5/11/06, Mike Krell <[EMAIL PROTECTED]> wrote: > On 5/11/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > I think I'm more comfortable with a maximal taxonomy. In a maximal > > taxonomy, I'd describe a large set of invariants, attributes, > > behavior, etc., and say e.g. "this is how a file b

Re: [Python-3000] What do do about IDLE?

2006-05-11 Thread Ronald Oussoren
On 11-mei-2006, at 21:06, Jan Claeys wrote: > Op ma, 08-05-2006 te 11:59 -0400, schreef Fred L. Drake, Jr.: >> Yes, there is a good reason for Tkinter to be separate. There's >> not a good >> reason for distutils to be separate. > > Why would ordinary end-users of an application written in Pyt

[Python-3000] Math in Python 3.0

2006-05-11 Thread Fredrik Johansson
Hi all, Some assorted thoughts: Python's current numeric model has serious problems. It's fine for calculating with nothing but floats, or nothing but ints, but writing code that works for ints, floats, complexes *and* Decimals - let alone for custom types such as mpfs or numeric arrays - is near

Re: [Python-3000] What do do about IDLE?

2006-05-11 Thread Fred L. Drake, Jr.
On Thursday 11 May 2006 15:06, Jan Claeys wrote: > Why would ordinary end-users of an application written in Python need > distutils? They will get their application as a py2exe executable (or > similar) on Windows, as a distro package on linux and on Mac OS X there > is py2app IIRC. And even

Re: [Python-3000] What do do about IDLE?

2006-05-11 Thread Jan Claeys
Op ma, 08-05-2006 te 11:59 -0400, schreef Fred L. Drake, Jr.: > Yes, there is a good reason for Tkinter to be separate. There's not a good > reason for distutils to be separate. Why would ordinary end-users of an application written in Python need distutils? They will get their application as

Re: [Python-3000] prototype OO?

2006-05-11 Thread Raymond Hettinger
Jim Jewett wrote: >There are languages (Self; I think even javascript) whose OO is based >on Prototypes rather than classes. If an object doesn't have the >attribute/method, then check its prototype (and so on recursively). > >When I have to emulate this in python (or Java), I just try to shove >

Re: [Python-3000] Questions on optional type annotations

2006-05-11 Thread Guido van Rossum
On 5/11/06, Talin <[EMAIL PROTECTED]> wrote: > Some of the other open issues with signatures are as follows: > > o How to use the signature to be able to predict which input arguments > are going to map against which formal parameters. Well, there's supposed to be an algorithm defined by the lan

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Talin
Guido van Rossum wrote: > On 5/11/06, Talin <[EMAIL PROTECTED]> wrote: > >> The word 'sequence' here doesn't mean an exclusive category. In a sense, >> all sequences are really mappings - they "map" a range of integers to >> values. > > > No, the requirements for sequence-ness are stronger. The

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Guido van Rossum
On 5/11/06, Talin <[EMAIL PROTECTED]> wrote: > The word 'sequence' here doesn't mean an exclusive category. In a sense, > all sequences are really mappings - they "map" a range of integers to > values. No, the requirements for sequence-ness are stronger. The set of ints mapped must be exactly rang

[Python-3000] prototype OO?

2006-05-11 Thread Jim Jewett
On 5/11/06, tomer filiba <[EMAIL PROTECTED]> wrote: > class myFrame(derive_of(c.modules.wx.Frame)): > ... > c.modules.wx.Frame is a proxy (instance) to a remote type, so you can't > derive from it directly. therefore, derive_of is > def derive_of(proxy_type): > class cls(object): >

Re: [Python-3000] Questions on optional type annotations

2006-05-11 Thread Talin
Nick Coghlan wrote: > Talin wrote: > >> I haven't forgotten that you asked me to write up a PEP for a >> signature API in conjunction with the keyword arguments PEP. However, >> I don't yet feel that the ideas have gelled enough to do so yet -- or >> at least, I don't feel competent to come up

Re: [Python-3000] i guess i was misunderstood

2006-05-11 Thread Guido van Rossum
[Guido] > > You seem to be still under the influence of the type-safety mafia, who > > want to make you believe that with enough type-checking you can > > prevent all bugs (though they don't believe it themselves). [Talin, quoetd by Guido] > >> I think that I agree with the gist of Tomer's point.

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Talin
Ideally, if we get the signature API that's been discussed, then lists and tuples and such would have a constraint on their __getitem__ method: def __getitem__( self, index:int ): ... Thus, the concept testing code could look to see what types are acceptable to the __getitem__ method

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Talin
The word 'sequence' here doesn't mean an exclusive category. In a sense, all sequences are really mappings - they "map" a range of integers to values. From the standpoint of accepting an argument, we really don't care whether something is a sequence or a mapping, we care about what we can do

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Steven Bethard
On 5/11/06, Talin <[EMAIL PROTECTED]> wrote: > sequence( indexable ): > -- an indexable in which the indexes are successive integers > -- Test: isinstance( index_type, int ) I think as of Python 2.5, this should be hasattr(index_type, '__index__'), no? > mapping( indexable ): > -- an

[Python-3000] i guess i was misunderstood

2006-05-11 Thread tomer filiba
"Guido van Rossum" python.org> wrote > You seem to be still under the influence of the type-safety mafia, who > want to make you believe that with enough type-checking you can > prevent all bugs (though they don't believe it themselves). ~~ >> I think that I agree with the gist of Tomer's point. >

Re: [Python-3000] Requirements for a standard GUI library

2006-05-11 Thread Antoine Pitrou
Le jeudi 11 mai 2006 à 10:00 -0600, Travis E. Oliphant a écrit : > > That sounds reasonable. As I said before, I like the idea of PyGUI. > My main consternation is wxWindows. I'm not a big fan of how wxPython > builds on top of wxWindows which builds on top of GTK which itself > builds on G

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Phillip J. Eby
At 04:27 PM 5/11/2006 +0100, [EMAIL PROTECTED] wrote: >Why not > >class Foo(object): > @specialize(arg(0)) > def core.len(self) > ... Where does 'core' come from? What is specialize for? I don't understand what you're proposing. >I don't know how this would app

Re: [Python-3000] What do do about IDLE?

2006-05-11 Thread Bill Janssen
> So my thought is this: How hard would it be to make > a curses-based debugger? Long as it works in my Emacs shell buffer... Bill ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http

Re: [Python-3000] Questions on optional type annotations

2006-05-11 Thread Edward Loper
Marcin 'Qrczak' Kowalczyk wrote: > "Neal Norwitz" <[EMAIL PROTECTED]> writes: > >> Another benefit of this is the ability to get more info through >> introspection. Right now, you can't even find the number of >> arguments of a function implemented in C. You only know if it takes >> 0, 1, or varia

Re: [Python-3000] Requirements for a standard GUI library

2006-05-11 Thread Travis E. Oliphant
Greg Ewing wrote: > Travis E. Oliphant wrote: >> The only thing I would wish different is to get rid of the PyGTK >> dependency. I think PyGUI should be a wrapper directly on top of GNOME > > Perhaps you have Gnome and Gtk confused? Gnome is the > desktop, Gtk is the UI library that Gnome appli

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Paul Moore
On 5/11/06, Bill Birch <[EMAIL PROTECTED]> wrote: > On Thu, 11 May 2006 12:38 am, you wrote: > > On 5/10/06, Bill Birch <[EMAIL PROTECTED]> wrote: > > > A simple test to see where your thinking is at. Consider: [...] > > Clearly False - D() is not an object of type I1. > > > > Of course, whether is

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Ben . Young
"Phillip J. Eby" <[EMAIL PROTECTED]> wrote on 11/05/2006 16:09:47: > At 10:12 AM 5/11/2006 +0100, [EMAIL PROTECTED] wrote: > >A dynamic version of concepts (I guess a combo of multi-methods and > >adaptation) would be great for Python, but it's hard to see how it could > >be done simply and effic

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Phillip J. Eby
At 10:12 AM 5/11/2006 +0100, [EMAIL PROTECTED] wrote: >A dynamic version of concepts (I guess a combo of multi-methods and >adaptation) would be great for Python, but it's hard to see how it could >be done simply and efficiently. Go back and read the post where I explained how, then. ;) Seriousl

Re: [Python-3000] my take on "typeclasses"

2006-05-11 Thread Marcin 'Qrczak' Kowalczyk
Talin <[EMAIL PROTECTED]> writes: > sequence( indexable ): > -- an indexable in which the indexes are successive integers > -- Test: isinstance( index_type, int ) I don't understand. How would this test distinguish [] being a sequence from {} not being a sequence? > mapping( indexable ):

Re: [Python-3000] Questions on optional type annotations

2006-05-11 Thread Marcin 'Qrczak' Kowalczyk
"Neal Norwitz" <[EMAIL PROTECTED]> writes: > Another benefit of this is the ability to get more info through > introspection. Right now, you can't even find the number of > arguments of a function implemented in C. You only know if it takes > 0, 1, or variable # of arguments and if it accepts keyw

Re: [Python-3000] Questions on optional type annotations

2006-05-11 Thread Nick Coghlan
Talin wrote: > Guido van Rossum wrote: >> I think it would be useful to have a notation that can express >> signatures. I haven't spent much time thinking about what this would >> look like, but I'd like it to require no new syntax beyond the concept >> of type annotations. If this means you can't

[Python-3000] Argument Decorators (was Re: my take on "typeclasses")

2006-05-11 Thread Bill Birch
On Thu, 11 May 2006 03:30 pm, Guido van Rossum wrote: > > Bill Janssen is proposing that the specific thing a type must do is > inherit from some abstract base class. > > Phillip Eby is countering that that isn't sufficient because he wants > to be able to make up his own categories and apply thes

Re: [Python-3000] why interfaces shouldn't be trusted

2006-05-11 Thread Nick Coghlan
Marcin 'Qrczak' Kowalczyk wrote: > "tomer filiba" <[EMAIL PROTECTED]> writes: > >> one thing that worries me with generic methods is, they would >> dispatch based on types... which means my proxies would all break. >> please, think of the proxies! ;) > > OTOH proxies generated by my Python<->Kogu

Re: [Python-3000] back with more GUI planning in a few days...

2006-05-11 Thread Ivan Krstic
Bill Janssen wrote: >> to want to task a general GUI toolkit with producing >> HTML and Javascript, running a HTTP server, and automagically dealing >> with all the server-side logic seems a bit like a really bad joke. > > You've never looked at X11 under the covers (it looks like Mac OS X's > win

Re: [Python-3000] Fw: typeclasses, duck-typing

2006-05-11 Thread Ben . Young
[EMAIL PROTECTED] wrote on 10/05/2006 17:39:57: > At 11:21 AM 5/10/2006 +0100, [EMAIL PROTECTED] wrote: > >Have you taken a look at ConceptGCC? ( > >http://www.osl.iu.edu/~dgregor/ConceptGCC/) > > > >It's basically a first cut at implementing the Concepts which will be > >availiable in the next v

Re: [Python-3000] GUI -- an API, not a toolkit

2006-05-11 Thread Ronald Oussoren
On 11-mei-2006, at 8:45, Talin wrote: > Josiah Carlson wrote: >> Having identical behavior on all platforms is wonderful, I'm very >> happy >> for you and everyone else with a toolkit (programming language, >> etc.) that >> does the same. For the rest of us who cannot use PyQt for one >> re