Re: [Python-3000] Adaption & generic functions [was Generic functions]

2006-04-09 Thread Eli Stevens (WG.c)
Guido van Rossum wrote: > On 4/7/06, Walter Dörwald <[EMAIL PROTECTED]> wrote: >> An Interface is an abstract class that you subclass to make it a >> concrete implementation. > > That's not the view of most people who use the word interface these > days. Not in Zope (see Fred Drake's post), not in

Re: [Python-3000] Will we have a true restricted exec environment for python-3000?

2006-04-09 Thread Georg Brandl
Greg Ewing wrote: > Nick Coghlan wrote: > >> If yes, then you can get to object(), and hence to pretty much whatever C >> builtins you want. > > Perhaps instead of attributes like __class__ and __subtypes__ > there should be functions like classof() and subtypes() that > could be excluded from a

Re: [Python-3000] Will we have a true restricted exec environment for python-3000?

2006-04-09 Thread Vineet Jain
> around to it before 2.5 goes final. Without thinking much, I expect > this would be a special build (ie, require a compile time flag to > activate). > python_light should be built just like any other module that you can import into a CPython application. > your needs are. If you just want t

Re: [Python-3000] Adaption & generic functions [was Generic functions]

2006-04-09 Thread Paul Moore
On 4/7/06, Eli Stevens (WG.c) <[EMAIL PROTECTED]> wrote: > It seems to me that now to get a duck-typed list, not only do you have > to implement all of special methods that define "listy-ness," you also > have to find the overloaded functions that are specialized for lists, > and register your own

Re: [Python-3000] Sane transitive adaptation

2006-04-09 Thread Guido van Rossum
On 4/8/06, Talin <[EMAIL PROTECTED]> wrote: > You know, on the one hand, I've been reading this thread, and I'm > excited about the possibility of generic functions (dynamic dispatch, > duckaplex-typing, whatever you want to call it), but at the same time > I kind of wonder about the eventual effec

Re: [Python-3000] Adaption & generic functions [was Generic functions]

2006-04-09 Thread Guido van Rossum
On 4/7/06, Eli Stevens (WG.c) <[EMAIL PROTECTED]> wrote: > I'm curious what effect overloaded functions will have on duck typing; a > Something can act like a list, but from my understanding of the > discussion* it won't end up matching: > > @pprint.register(list) > def pprint_list(obj): > pas

Re: [Python-3000] Adaption & generic functions [was Generic functions]

2006-04-09 Thread Phillip J. Eby
At 12:58 PM 4/7/2006 -0700, "Eli Stevens (WG.c)" <[EMAIL PROTECTED]> wrote: >Guido van Rossum wrote: > > Did you forget duck typing? Something can be a sequence without > > subclassing a common base class. > > > >I'm curious what effect overloaded functions will have on duck typing; a >Something c

Re: [Python-3000] Adaption & generic functions [was Generic functions]

2006-04-09 Thread Ron Adam
Paul Moore wrote: > On 4/7/06, Eli Stevens (WG.c) <[EMAIL PROTECTED]> wrote: >> It seems to me that now to get a duck-typed list, not only do you have >> to implement all of special methods that define "listy-ness," you also >> have to find the overloaded functions that are specialized for lists, >

[Python-3000] AST access (WAS: Adaptation vs. Generic Functions)

2006-04-09 Thread Steven Bethard
On 4/8/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > To me an AST access feature would only be useful for changing the "VM" that > Python code runs on. For example, there is an object-relational mapper out > there (I think it's Robert Brewer's DejaVu system) that takes Python > generator express

Re: [Python-3000] Will we have a true restricted exec environment for python-3000?

2006-04-09 Thread Alexander Schremmer
On Sat, 8 Apr 2006 18:18:13 -0700, Neal Norwitz wrote: > #3 is easy to do a simple, naive implementation. I don't know what > your needs are. If you just want to say "exit this script if it ran > more than N seconds" you can just modify the eval loop (*). Unfortunately, it is not as easy as tha

Re: [Python-3000] AST access (WAS: Adaptation vs. Generic Functions)

2006-04-09 Thread Robert Brewer
Title: RE: [Python-3000] AST access (WAS: Adaptation vs. Generic Functions) Steven Bethard wrote: > On 4/8/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > > To me an AST access feature would only be useful for > > changing the "VM" that Python code runs on.  For example, > > there is an objec

Re: [Python-3000] Adaptation vs. Generic Functions

2006-04-09 Thread Tim Hochberg
"""This is my attempt to rewrite pprint.py to be based on protocols. Or overloading or specialization or whatever they end up being called ;-). My first attempt only touched about 20 lines of the original pprint and probably had 90% of the usability gain that this one does, but for some reason I

Re: [Python-3000] Adaptation vs. Generic Functions

2006-04-09 Thread Neal Norwitz
On 4/9/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > > Let me add this cautionary note -- this primarily intended as for > illustrative purposes. There's a good chance it has bugs. It does, > however, pass > test_pprint except for test_subclassing, which it can't really be > expected to pass. Py3k

Re: [Python-3000] Will we have a true restricted exec environment for python-3000?

2006-04-09 Thread Bill Janssen
> Well, I remember this was one of the key goals Mitch Kapor > outlined for Python in his keynote at PyCon. He blogged about it > too: > > http://blogs.osafoundation.org/mitch/000559.html I'm very interested in this, too. There are two things that force me into writing Java code instead of Py

Re: [Python-3000] Sane transitive adaptation

2006-04-09 Thread Tim Hochberg
Guido van Rossum wrote: > On 4/8/06, Talin <[EMAIL PROTECTED]> wrote: > >>You know, on the one hand, I've been reading this thread, and I'm >>excited about the possibility of generic functions (dynamic dispatch, >>duckaplex-typing, whatever you want to call it), but at the same time >>I kind of wo

Re: [Python-3000] Kill "generic functions"!

2006-04-09 Thread Delaney, Timothy (Tim)
Guido van Rossum wrote: > What about overloaded functions, which is the term used in C++ and > Java for a similar mechanism (that happens at compile-time -- but it's > standard Python practice to move things to run-time). We could then > also talk about overloaded methods when we're using the mech

Re: [Python-3000] Will we have a true restricted exec environment for python-3000?

2006-04-09 Thread Greg Ewing
Georg Brandl wrote: > Even as properties and methods, they can be restricted, > like func_code is now. Yes, but that means special-casing all the attribute accessors for them, and being careful to maintain the code which enforces the restrictions. If they're functions, the restriction is implem

Re: [Python-3000] Will we have a true restricted exec environment for python-3000?

2006-04-09 Thread Greg Ewing
Georg Brandl wrote: > Even as properties and methods, they can be restricted, Another thought is that if they're functions, there are more options available to the person wanting to impose restrictions. Instead of removing them altogether, he could replace them with versions that allow some subse

Re: [Python-3000] Will we have a true restricted exec environmentfor python-3000?

2006-04-09 Thread Giovanni Bajo
Neal Norwitz <[EMAIL PROTECTED]> wrote: > #3 is easy to do a simple, naive implementation. I don't know what > your needs are. If you just want to say "exit this script if it ran > more than N seconds" you can just modify the eval loop (*). But I > suspect there are many more features that would

Re: [Python-3000] Adaptation vs. Generic Functions

2006-04-09 Thread Guido van Rossum
On 4/9/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > Rather than having you scroll all through this long message/file, I'll instead > place all the examples up here at the top. Assuming that you save this as > pprint2.py, you should be able to run the examples just by executing the > file. Suggest

Re: [Python-3000] AST access (WAS: Adaptation vs. Generic Functions)

2006-04-09 Thread Greg Ewing
Robert Brewer wrote: > Part of the benefit of the bytecode-hacking is that your expression > never has to be in a string. I'm wondering whether there should be some kind of "code literal" syntax, where you write a Python expression and the compiler transforms it as far as the AST stage, then make

Re: [Python-3000] Will we have a true restricted exec environment for python-3000?

2006-04-09 Thread Michael P. Soulier
On 09/04/06 Bill Janssen said: > I'm very interested in this, too. There are two things that force me > into writing Java code instead of Python code, and they are: > > 1) The Java plug-in for Web browsers, and > > 2) The integrated portable fairly capable Swing GUI. And 2 + the JRE and jar

Re: [Python-3000] Will we have a true restricted exec environmentfor python-3000?

2006-04-09 Thread Neal Norwitz
On 4/9/06, Giovanni Bajo <[EMAIL PROTECTED]> wrote: > Neal Norwitz <[EMAIL PROTECTED]> wrote: > > > #3 is easy to do a simple, naive implementation. I don't know what > > your needs are. If you just want to say "exit this script if it ran > > more than N seconds" you can just modify the eval loop

Re: [Python-3000] AST access (WAS: Adaptation vs. Generic Functions)

2006-04-09 Thread Guido van Rossum
On 4/9/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Robert Brewer wrote: > > Part of the benefit of the bytecode-hacking is that your expression > > never has to be in a string. > > I'm wondering whether there should be some kind of > "code literal" syntax, where you write a Python > expression and

Re: [Python-3000] Will we have a true restricted exec environment for python-3000?

2006-04-09 Thread Guido van Rossum
On 4/9/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Another way of looking at it is that I'm suggesting > a more capability-oriented way of handling this -- > whether you can do something depends on whether you > have access to a function or object that does it. I'm not sure how that would help. Wh

Re: [Python-3000] Adaptation vs. Generic Functions

2006-04-09 Thread Tim Hochberg
Guido van Rossum wrote: > On 4/9/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > >>Rather than having you scroll all through this long message/file, I'll instead >>place all the examples up here at the top. Assuming that you save this as >>pprint2.py, you should be able to run the examples just by e

Re: [Python-3000] AST access (WAS: Adaptation vs. Generic Functions)

2006-04-09 Thread Robert Brewer
Title: RE: [Python-3000] AST access (WAS: Adaptation vs. Generic Functions) Guido van Rossum wrote: > On 4/9/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Robert Brewer wrote: > > > Part of the benefit of the bytecode-hacking is that > > > your _expression_ never has to be in a string. > > >