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

2010-04-05 Thread Cesare Di Mauro
2010/4/6 Antoine Pitrou > Greg Ewing canterbury.ac.nz> writes: > > > > Maybe it would be better to deprecate globals() and locals() > > and replace them with another function called something like > > scope(). > > It is useful to distinguish between globals (i.e., module-level variables) > and >

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 5:44 PM, Greg Ewing wrote: > 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 yo

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 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 trying to optimiz

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. -- Gr

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

2010-04-05 Thread Antoine Pitrou
Greg Ewing canterbury.ac.nz> writes: > > Maybe it would be better to deprecate globals() and locals() > and replace them with another function called something like > scope(). It is useful to distinguish between globals (i.e., module-level variables) and locals, so replacing them with scope() wo

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 taki

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 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 glo

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

2010-04-05 Thread Greg Ewing
Antoine Pitrou wrote: Steve Bonner 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 replace them wit

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 3:03 PM, "Martin v. Löwis" 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 unwound. I

Re: [Python-Dev] python compiler

2010-04-05 Thread Martin v. Löwis
> 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 unwound. I thought Maciej was suggesting that having > full Python frames

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 2:21 PM, Michael Foord 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 choice. I he

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, pi

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 1:47 PM, Craig Citro 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 seem the right

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 alr

Re: [Python-Dev] python compiler

2010-04-05 Thread Craig Citro
> 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 seem the right place to list Cython to me. (Much though > I admire Cyt

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 prac

Re: [Python-Dev] python compiler

2010-04-05 Thread Guido van Rossum
On Mon, Apr 5, 2010 at 8:49 AM, Maciej Fijalkowski 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 wrote: > It's tru

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

Re: [Python-Dev] python compiler

2010-04-05 Thread Maciej Fijalkowski
On Mon, Apr 5, 2010 at 9:31 AM, Craig Citro 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 -- for

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 itsel

Re: [Python-Dev] python compiler

2010-04-05 Thread Reid Kleckner
On Mon, Apr 5, 2010 at 11:11 AM, Michael Foord 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 PyPy and > Unladen Swall

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 pl

Re: [Python-Dev] python compiler

2010-04-05 Thread Michael Foord
On 05/04/2010 15:54, 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. Python itself is a highly dynamic language and not amenable to direct compi

[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 http://mail.python.org/mailman/lis

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 leavi

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

2010-04-05 Thread Antoine Pitrou
Steve Bonner 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 be consi

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