Re: [Python-Dev] nonlocals() function?

2010-04-05 Thread Greg Ewing
Carl M. Johnson wrote: * It would make method in dir(obj) marginally faster Wouldn't hasattr(obj, method) be a better way to do that? * Even though the order isn’t important for code, it’s convenient at the interactive prompt to see the methods of an item in alphabetical order for quick

Re: [Python-Dev] nonlocals() function?

2010-04-05 Thread Antoine Pitrou
Steve Bonner pythonsteve at gmail.com writes: What do we think of adding a built-in nonlocals() function that would be similar to globals() and locals()?  Like those functions, it would return a dictionary of variable names and their values. Since we now have the nonlocal statement, it would

Re: [Python-Dev] nonlocals() function?

2010-04-05 Thread Nick Coghlan
Greg Ewing wrote: * Even though the order isn’t important for code, it’s convenient at the interactive prompt to see the methods of an item in alphabetical order for quick scanning. Since I suspect this is most people's main use for dir(), I think it's a good enough reason for leaving

[Python-Dev] python compiler

2010-04-05 Thread willian
for a college project, I proposed to create a compiler for python. I've read something about it and maybe I saw that made a bad choice. I hear everyone's opinion respond. ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] python compiler

2010-04-05 Thread Oleg Broytman
Hello. We'are sorry but we cannot help you. This mailing list is to work on developing Python (fixing bugs and adding new features to Python itself); if you're having problems using Python, please find another forum. Probably python-list (comp.lang.python) news group/mailing list is the best

Re: [Python-Dev] python compiler

2010-04-05 Thread Reid Kleckner
On Mon, Apr 5, 2010 at 11:11 AM, Michael Foord fuzzy...@voidspace.org.uk wrote: Python itself is a highly dynamic language and not amenable to direct compilation. Instead modern just-in-time compiler technology is seen as the way to improve Python performance. Projects that are doing this are

Re: [Python-Dev] python compiler

2010-04-05 Thread Craig Citro
for a college project, I proposed to create a compiler for python. I've read something about it and maybe I saw that made a bad choice. I hear everyone's opinion respond. I don't think everyone thinks this is a bad idea -- for instance, those of us working on Cython [1], which is itself a

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 9:31 AM, Craig Citro craigci...@gmail.com wrote: for a college project, I proposed to create a compiler for python. I've read something about it and maybe I saw that made a bad choice. I hear everyone's opinion respond. I don't think everyone thinks this is a bad idea

Re: [Python-Dev] python compiler

2010-04-05 Thread Craig Citro
I hate to remind you but Cython is *not* python. It does not even plan to support all of the parts which are considered python semantics (like tracebacks and frames). It's true -- we basically compile to C + the Python/C API, depending on CPython being around for runtime support, and I don't

Re: [Python-Dev] python compiler

2010-04-05 Thread Guido van Rossum
On Mon, Apr 5, 2010 at 8:49 AM, Maciej Fijalkowski fij...@gmail.com wrote: I hate to remind you but Cython is *not* python. It does not even plan to support all of the parts which are considered python semantics (like tracebacks and frames). On Mon, Apr 5, 2010 at 10:32 AM, Craig Citro

Re: [Python-Dev] nonlocals() function?

2010-04-05 Thread average
globals() and locals() return dicts mapping names to objects. Damn, I totally pulled a *?!* on that one. I should have pulled out my Python reference. I was thinking of dir() and thought that these functions were similar. Apologies for that. However, I still do believe that as a general

Re: [Python-Dev] python compiler

2010-04-05 Thread Terry Reedy
On 4/5/2010 10:54 AM, will...@ufpa.br wrote: for a college project, I proposed to create a compiler for python. I've read something about it and maybe I saw that made a bad choice. I hear everyone's opinion respond. If you want to do something useful, pick an existing project (several have

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 1:47 PM, Craig Citro craigci...@gmail.com wrote: There has been some contentious debate about this in the past, where a Cython developer(s?) insisted Cython be listed among the Python implementations somewhere, on a par with IronPython, Jython and PyPy. This does not

Re: [Python-Dev] python compiler

2010-04-05 Thread Michael Foord
On 05/04/2010 21:10, Terry Reedy wrote: On 4/5/2010 10:54 AM, will...@ufpa.br wrote: for a college project, I proposed to create a compiler for python. I've read something about it and maybe I saw that made a bad choice. I hear everyone's opinion respond. If you want to do something useful,

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 2:21 PM, Michael Foord fuzzy...@voidspace.org.uk wrote: On 05/04/2010 21:10, Terry Reedy wrote: On 4/5/2010 10:54 AM, will...@ufpa.br wrote: for a college project, I proposed to create a compiler for python. I've read something about it and maybe I saw that made a bad

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 3:03 PM, Martin v. Löwis mar...@v.loewis.de wrote: Is the requirement just the construction of full tracebacks in the event of an exception? Because Cython does that right now. In the event of an exception, the Python call frames are constructed as the C call stack is

[Python-Dev] Scope object (Re: nonlocals() function?)

2010-04-05 Thread Greg Ewing
Antoine Pitrou wrote: Steve Bonner pythonsteve at gmail.com writes: What do we think of adding a built-in nonlocals() function that would be similar to globals() and locals()? These scopes don't have parallel capabilities: Maybe it would be better to deprecate globals() and locals() and

Re: [Python-Dev] Scope object (Re: nonlocals() function?)

2010-04-05 Thread Michael Foord
On 06/04/2010 00:37, Greg Ewing wrote: Antoine Pitrou wrote: Steve Bonner pythonsteve at gmail.com writes: What do we think of adding a built-in nonlocals() function that would be similar to globals() and locals()? These scopes don't have parallel capabilities: Maybe it would be better to

Re: [Python-Dev] python compiler

2010-04-05 Thread Greg Ewing
will...@ufpa.br wrote: for a college project, I proposed to create a compiler for python. I've read something about it and maybe I saw that made a bad choice. I hear everyone's opinion respond. I don't want to discourage you if you really want to try, but you need to be aware that you'd be

Re: [Python-Dev] python compiler

2010-04-05 Thread Greg Ewing
Craig Citro wrote: In the event of an exception, the Python call frames are constructed as the C call stack is unwound. Although in Pyrex the frames have just enough info in them to find out the file name and line number -- the rest (f_stack, f_locals, etc.) are filled with dummy values. --

Re: [Python-Dev] Scope object (Re: nonlocals() function?)

2010-04-05 Thread Reid Kleckner
On Mon, Apr 5, 2010 at 7:35 PM, Antoine Pitrou solip...@pitrou.net wrote: If you can prove that making locals() (or its replacement) writable doesn't complicate the interpreter core too much, then why not. Otherwise -1 :-) I think writable locals would significantly complicate the job of people