[Python-Dev] AST manipulation and source code generation

2005-05-23 Thread Ka-Ping Yee
Would there be any interest in extending the compiler package with tools for AST transformations and for emitting Python source code from ASTs? I was experimenting with possible translations for exception chaining and wanted to run some automated tests, so i started playing around with the compile

Re: [Python-Dev] Adventures with Decimal

2005-05-23 Thread Aahz
On Mon, May 23, 2005, Greg Ewing wrote: > > But I also found it interesting that, while the spec requires the > existence of a context for each operation, it apparently *doesn't* > mandate that it must be kept in a global variable, which is the part > that makes me uncomfortable. > > Was there any

[Python-Dev] __trace__? (was Re: PEP 344: Explicit vs. Implicit Chaining

2005-05-23 Thread Phillip J. Eby
At 10:33 AM 5/21/2005 -0400, James Y Knight wrote: >On May 20, 2005, at 6:37 PM, Phillip J. Eby wrote: > > This only helps if you can get to a debugger. What if you're > > reading your web server's error log? > >Then you're in trouble anyways because you need the contents of some >local to figure

Re: [Python-Dev] PEP 344: Explicit vs. Implicit Chaining

2005-05-23 Thread Michael Chermside
James Knight writes: > I still don't see why people think the python interpreter should be > automatically providing __context__. To me it seems like it'll just > clutter things up for no good reason. If you really want the other > exception, you can access it via the local variable in the frame >

Re: [Python-Dev] Adventures with Decimal

2005-05-23 Thread Michael Chermside
I'd like to respond to a few people, I'll start with Greg Ewing: Greg writes: > I don't see how it > helps significantly to have just the very first > step -- turning the input into numbers -- be > exempt from this behaviour. If anything, people > are going to be even more confused. "But it > can

Re: [Python-Dev] Adventures with Decimal

2005-05-23 Thread Nick Coghlan
Raymond Hettinger wrote: >>Py> decimal.Decimal("a", context) >>Decimal("NaN") >> >>I'm tempted to suggest deprecating the feature, and say if you want >>invalid >>strings to produce NaN, use the create_decimal() method of Context >>objects. > > > The standard does require a NaN to be produced. I

Re: [Python-Dev] Adventures with Decimal

2005-05-23 Thread Greg Ewing
Raymond Hettinger wrote: > Did you see Mike Cowlishaw's posting where he described why he took our > current position (wysiwig input) in the spec, in Java's BigDecimal, and > in Rexx's numeric model? Yes, it appears that you have channeled him correctly on that point, and Tim hasn't. :-) But I al