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

2006-04-10 Thread Talin
Greg Ewing canterbury.ac.nz> writes: > 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 makes it available to the > program as an AST object. > > Or would that be too c

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

2006-04-10 Thread Nick Coghlan
Michael P. Soulier wrote: > 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 Sw

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

2006-04-10 Thread Greg Ewing
Guido van Rossum wrote: > I'm more concerned about the choice of AST data structure and how it > affects IronPython, PyPy, Jython and possible other Python > implementations. I'd like to keep both the AST and the bytecode spec > out of the language spec, Well, it wouldn't be any less portable tha

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

2006-04-10 Thread Greg Ewing
Guido van Rossum wrote: > I'm not sure how that would help. What would it mean to have a > capability for accessing e.g. x.__class__? If you can somehow get a reference to the __builtin__.classof() function, then you have that capability, otherwise you don't. The key idea is that by turning pote

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

2006-04-10 Thread Chaz.
For a rather large application I am writing and will be running for a commercial service, I ran into the restricted environment problem. I had looked at the CPython code and concluded it would be a rather large job to secure it (if I had the time and the intimate understanding). Instead I opted

Re: [Python-3000] A few small py3k wishes

2006-04-10 Thread Gareth McCaughan
On Friday 2006-04-07 20:52, Guido van Rossum wrote: > On 4/4/06, Gareth McCaughan <[EMAIL PROTECTED]> wrote: > > I take no stand on how much not confusing Lispers matters > > to Python 3k. > > But I do: none whatsoever. I thought as much. :-) -- g _

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

2006-04-10 Thread Guido van Rossum
On 4/10/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > > I'm more concerned about the choice of AST data structure and how it > > affects IronPython, PyPy, Jython and possible other Python > > implementations. I'd like to keep both the AST and the bytecode spec > > out of t

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

2006-04-10 Thread Guido van Rossum
On 4/10/06, Talin <[EMAIL PROTECTED]> wrote: > I have a rather odd use case for this. A while back, I decided I wanted to > write an algebraic solver, similar to what Mathematica does, except that > I wanted to write it in Python. Not just implement it in Python, but have > Python be the language i

[Python-3000] symbols?

2006-04-10 Thread Kendall Clark
Folks, One thing I'd really like to see in Python 3000 is support for first- class symbols, with literal syntax. Stealing syntax from Ruby would work for me: def web_dispatch("/bank-account", :GET, retrieve_account): pass The lack thereof in Python is a wart I tend to run into in Pyth

Re: [Python-3000] symbols?

2006-04-10 Thread Barry Warsaw
On Mon, 2006-04-10 at 12:16 -0400, Kendall Clark wrote: > I don't know if the Ruby syntax for symbols, :foo, will work in > Python (though I think visually it's a good thing), but it would be > really nice to have symbols with *some* syntax in Python 3000. To be fair, I think Ruby stole the i

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

2006-04-10 Thread Ian Bicking
Nick Coghlan wrote: > And once you move to an out-of-process sandbox, then the only Python specific > issue remaining is improving the support for inter-process communications. > The > security issues are then more in the domain of the OS: >- controlling file access permissions on a per-proc

[Python-3000] Adaptation and type declarations

2006-04-10 Thread Jim Jewett
Every so often Guido talks about adding optional typing to python. Adaptation may offer the cleanest way to do this. Turning def fn(a, b, c="default"): ... into any of def fn(Seq a, Index b, Text c="default"): ... def fn(Seq(a), Index(b), Text(c)="default"): ... or (wrapped ver

Re: [Python-3000] symbols?

2006-04-10 Thread Kendall Clark
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Apr 10, 2006, at 12:24 PM, Barry Warsaw wrote: > On Mon, 2006-04-10 at 12:16 -0400, Kendall Clark wrote: > >> I don't know if the Ruby syntax for symbols, :foo, will work in >> Python (though I think visually it's a good thing), but it would be >>

Re: [Python-3000] symbols?

2006-04-10 Thread Georg Brandl
Kendall Clark wrote: > PS--I'd also like "?", "!", and "-" to be legal characters in > function, method, and variable names, but I won't push my luck -- and > I seem to remember Guido saying that would never happen, at some > point back in the day. Fair enough. ;> At least "-" can never be

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

2006-04-10 Thread Phillip J. Eby
At 08:39:36 PM 4/10/2006 -0700, "Guido van Rossum" <[EMAIL PROTECTED]> wrote: >On 4/10/06, Talin <[EMAIL PROTECTED]> wrote: > > I have a rather odd use case for this. A while back, I decided I wanted to > > write an algebraic solver, similar to what Mathematica does, except that > > I wanted to wri

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

2006-04-10 Thread Ian Bicking
Greg Ewing 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 the compiler transforms it as f

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

2006-04-10 Thread Bill Janssen
> And 2 + the JRE and jar files ease distribution of apps, something else that > Python needs to address.=20 I think we're very close to that with Python 2.5. Bill ___ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listin

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

2006-04-10 Thread Michael P. Soulier
On 10/04/06 Bill Janssen said: > I think we're very close to that with Python 2.5. Depends. I recently tried to install mechanize, and easytools tried to install a ton of dependencies, all requiring administrator access to install. --prefix didn't resolve dependencies, which isn't helpful if you'

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

2006-04-10 Thread Ian Bicking
Michael P. Soulier wrote: > On 10/04/06 Bill Janssen said: >>I think we're very close to that with Python 2.5. > > > Depends. I recently tried to install mechanize, and easytools tried to install > a ton of dependencies, all requiring administrator access to install. --prefix > didn't resolve dep

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

2006-04-10 Thread Guido van Rossum
On 4/10/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > > I'm not sure how that would help. What would it mean to have a > > capability for accessing e.g. x.__class__? > > If you can somehow get a reference to the > __builtin__.classof() function, then you > have that capabi

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

2006-04-10 Thread Adam DePrince
On Sun, 2006-04-09 at 18:06 -0700, Neal Norwitz wrote: > On 4/9/06, Giovanni Bajo <[EMAIL PROTECTED]> wrote: > > Neal Norwitz <[EMAIL PROTECTED]> wrote: > >>> r.setrlimit(r.RLIMIT_CPU, (5, 5)) > >>> 1000**1000 > Cputime limit exceeded > > To defeat this, you can do

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

2006-04-10 Thread Michael P. Soulier
On 10/04/06 Ian Bicking said: > If you have specific problems you should email [email protected] > (and/or the mechanize maintainer) and describe the problems you are > having, and what the desired behavior would be. > > And maybe try the svn trunk version of setuptools first to see if y

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Guido van Rossum
On 4/10/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > Every so often Guido talks about adding optional typing to python. > > Adaptation may offer the cleanest way to do this. > > > Turning > > def fn(a, b, c="default"): ... > > into any of > > def fn(Seq a, Index b, Text c="default"): ... >

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Chaz.
If you are going this far, why not also support a throws() modifier (or whatever you might call it). Right now I do something like: @throws(IOError) def foo(...) : as a way to indicate that foo() can throw a specific exception. I might suggest def foo(...) throws(...) : as a more integrated

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Jim Jewett
On 4/10/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > The only syntax that is acceptable to me ... would look like > def fn(a: Seq, b: Index, c: Text = "default"): ... > where Seq, Index and Text can be expressions (the main problem with > the syntax you propose is that the type can't be muc

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

2006-04-10 Thread Guido van Rossum
> Greg Ewing wrote: > > 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 makes it available to the > > program as an AST object. On 4/10/06, Ian Bicking <[EMAIL PRO

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Josiah Carlson
"Chaz." <[EMAIL PROTECTED]> wrote: > If you are going this far, why not also support a throws() modifier (or > whatever you might call it). > > Right now I do something like: > > @throws(IOError) > def foo(...) : ... > I might suggest > > def foo(...) throws(...) : > > as a more integrated ap

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Georg Brandl
Chaz. wrote: > If you are going this far, why not also support a throws() modifier (or > whatever you might call it). > > Right now I do something like: > > @throws(IOError) > def foo(...) : > > as a way to indicate that foo() can throw a specific exception. > > I might suggest > > def foo(..

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Guido van Rossum
On 4/10/06, Chaz. <[EMAIL PROTECTED]> wrote: > If you are going this far, why not also support a throws() modifier (or > whatever you might call it). > > Right now I do something like: > > @throws(IOError) > def foo(...) : > > as a way to indicate that foo() can throw a specific exception. > > I mi

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Chaz.
Is that what adding some typing to the system will do? Josiah Carlson wrote: > "Chaz." <[EMAIL PROTECTED]> wrote: >> If you are going this far, why not also support a throws() modifier (or >> whatever you might call it). >> >> Right now I do something like: >> >> @throws(IOError) >> def foo(...)

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Chaz.
Personally I don't care what you call it. If you demean it because you disagree, you might as well fore go the whole issue of typing arguments. After all why turn Python in Cobol? C. G. Georg Brandl wrote: > Chaz. wrote: >> If you are going this far, why not also support a throws() modifier (or

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Guido van Rossum
On 4/10/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 4/10/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > A completely separate issue is what kind of objects Seq, Index and > > Text would be; but that's a discussion we have separate from the > > syntactic discussion. > > What do you mean? Th

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Tim Hochberg
Guido van Rossum wrote: > On 4/10/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > >>Every so often Guido talks about adding optional typing to python. >> >>Adaptation may offer the cleanest way to do this. >> >> >>Turning >> >>def fn(a, b, c="default"): ... >> >>into any of >> >>def fn(Seq a,

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Tim Hochberg
Guido van Rossum wrote: > On 4/10/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > >>On 4/10/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: >> >>>A completely separate issue is what kind of objects Seq, Index and >>>Text would be; but that's a discussion we have separate from the >>>syntactic discussi

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Jim Jewett
On 4/10/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/10/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > > On 4/10/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > A completely separate issue is what kind of objects > > > Seq, Index and Text would be > > What do you mean? The only ques

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Guido van Rossum
[Guido] > > It should mean neither. As I tried to say, the *only* > > semantics is that the value of the expression is > > accessible through the __signature__ attribute of > > the function. It is then up to the decorator to decide > > what it means. [Jim Jewett] > So type annotation is only for u

[Python-3000] Did I miss anything?

2006-04-10 Thread Guido van Rossum
I've been intermittently following and skipping the Python-3000 list; my personal bandwidth just wasn't up to following everything. I know a few PEPs have been checked in (thanks Georg!). I know Adam DePrince has four different proto-PEPs up at http://www.deprince.net/ideas/peps.html but I don't k

Re: [Python-3000] Did I miss anything?

2006-04-10 Thread Steven Bethard
On 4/10/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Are there other proto-PEPs being worked on? I would appreciate if the > authors would send me a note (or reply here) with the URL and the > status. This is the Backwards Incompatibility PEP discussed earlier. I've submitted it for a PEP nu

Re: [Python-3000] Adaptation and type declarations

2006-04-10 Thread Josiah Carlson
"Chaz." <[EMAIL PROTECTED]> wrote: > Is that what adding some typing to the system will do? Not necessarily, but this particular instance isn't necessarily a typing-system issue. All sane or insane implementations of the @throws decorator that I can think of (annotation, exception translation, u

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

2006-04-10 Thread Greg Ewing
Guido van Rossum wrote: > Anyway, I'm not sure I consider this a strong use case for needing > access to Python's AST; the language you need to parse is much smaller > than Python and a custom parser would probably do just as well. So maybe this is an argument for having some kind of simple parsi

Re: [Python-3000] symbols?

2006-04-10 Thread Greg Ewing
Kendall Clark wrote: > Folks, > > One thing I'd really like to see in Python 3000 is support for first- > class symbols, > > def web_dispatch("/bank-account", :GET, retrieve_account): pass class SymGen: def __getattr__(self, name): return intern(name) sym = SymGen() web_dispatc

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

2006-04-10 Thread Phillip J. Eby
At 07:39 PM 4/10/2006 -0400, Blake Winton wrote: >Phillip J. Eby wrote: >>I tried doing something like this when I was writing RuleDispatch, and >>gave up in disgust because there's no sane way to implement "and" and >>"or" operations with this approach. The bitwise operators (&, |, and ~) >>bi

Re: [Python-3000] symbols?

2006-04-10 Thread Greg Ewing
Kendall Clark wrote: > One thing I'd really like to see in Python 3000 is support for first- > class symbols, with literal syntax. Actually I think enumerations would be more useful than symbols. There's no essential difference between a symbol and an interned string. The only real disadvantage

Re: [Python-3000] symbols?

2006-04-10 Thread Greg Ewing
Georg Brandl wrote: >>PS--I'd also like "?", "!", and "-" to be legal characters in >>function, method, and variable names, but I won't push my luck -- and >>I seem to remember Guido saying that would never happen, at some >>point back in the day. And I hope he never changes his mind! Ident

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

2006-04-10 Thread Blake Winton
Phillip J. Eby wrote: > I tried doing something like this when I was writing RuleDispatch, and gave > up in disgust because there's no sane way to implement "and" and "or" > operations with this approach. The bitwise operators (&, |, and ~) bind > too tightly to be used with comparison expressi

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

2006-04-10 Thread Guido van Rossum
On 4/10/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > Anyway, I'm not sure I consider this a strong use case for needing > > access to Python's AST; the language you need to parse is much smaller > > than Python and a custom parser would probably do just as well. > > So ma

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

2006-04-10 Thread Greg Ewing
Phillip J. Eby wrote: > I tried doing something like this when I was writing RuleDispatch, and gave > up in disgust because there's no sane way to implement "and" and "or" > operations with this approach. The bitwise operators (&, |, and ~) bind > too tightly to be used with comparison express

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

2006-04-10 Thread Greg Ewing
Adam DePrince wrote: > Instead of worrying about how to appropriately cripple CPython to > provide a secure sandbox, perhaps we should be reaching towards PyPy for > this answer? This thought might be relevant to another issue that came to my mind recently. It concerns using Python as an extens

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

2006-04-10 Thread Ian Bicking
Greg Ewing wrote: > So I think this is another, distinct use case for > wanting a "nested" Python environment. Here the goal > isn't to protect against a malicious user, since the > user running the application and the user doing the > scripting are the same person. Rather, it's just > to reduce th

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

2006-04-10 Thread Talin
Guido van Rossum python.org> writes: > > So maybe this is an argument for having some > > kind of simple parsing package in the stdlib, > > for knocking up little specialised languages > > like this. > > Now I'll *really* try to get pgen in. Unfortunately I can't make the > April 17 deadline. H

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

2006-04-10 Thread Talin
Greg Ewing canterbury.ac.nz> writes: > Perhaps you'd like to lend your support to PEP 335, then?-) > >http://www.python.org/dev/peps/pep-0335/ I think that would give me *most* of what I would need for my solver. What remains is a consise way to specify bound vs. unbound variables I would p

Re: [Python-3000] symbols?

2006-04-10 Thread Kendall Clark
On Apr 10, 2006, at 8:17 PM, Greg Ewing wrote: > Georg Brandl wrote: > >>> PS--I'd also like "?", "!", and "-" to be legal characters in >>> function, method, and variable names, but I won't push my luck -- >>> and >>> I seem to remember Guido saying that would never happen, at some >>> point b

Re: [Python-3000] symbols?

2006-04-10 Thread Kendall Clark
On Apr 10, 2006, at 8:05 PM, Greg Ewing wrote: > Kendall Clark wrote: >> Folks, >> >> One thing I'd really like to see in Python 3000 is support for first- >> class symbols, >> >> def web_dispatch("/bank-account", :GET, retrieve_account): pass > > class SymGen: > >def __getattr__(self, n

Re: [Python-3000] symbols?

2006-04-10 Thread Kendall Clark
On Apr 10, 2006, at 8:11 PM, Greg Ewing wrote: > Kendall Clark wrote: > >> One thing I'd really like to see in Python 3000 is support for first- >> class symbols, with literal syntax. > > Actually I think enumerations would be more useful than > symbols. I don't see why we couldn't have both or

Re: [Python-3000] Did I miss anything?

2006-04-10 Thread Kendall Clark
On Apr 10, 2006, at 6:19 PM, Guido van Rossum wrote: > Are there other proto-PEPs being worked on? I would appreciate if the > authors would send me a note (or reply here) with the URL and the > status. I told Barry I'd work on a proto-PEP for adding symbols (global, immutable things (or, if y

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

2006-04-10 Thread Neal Norwitz
On 4/10/06, Chaz. <[EMAIL PROTECTED]> wrote: > > I have thought the approach would work to make a plug-in for Firefox, > though lacking the time and the knowledge has stopped me from experimenting. Knowledge should not be an impediment, many of us would be interested in helping you learn what you