Re: [Python-Dev] Can Python implementations reject semantically invalid expressions?

2010-07-02 Thread Craig Citro
This question has an easy answer - can you possibly tell the difference? Ok, I'm obviously being silly here, but sure you can: dis.dis(raise TypeError()) 0 114 26977 3 1158293 6 IMPORT_STAR 7 SETUP_EXCEPT25968 (to 25978)

Re: [Python-Dev] Can Python implementations reject semantically invalid expressions?

2010-07-02 Thread Craig Citro
Whoa.  That's very peculiar looking bytecode.  Is dis.dis behaving as it should here? BTW, I think you want 'raise TypeError', not 'raise TypeError()'. Yep, that's embarrassing. I was being lazy: I was expecting different bytecodes, and I got it ... so I apparently didn't bother to actually

Re: [Python-Dev] Can Python implementations reject semantically invalid expressions?

2010-07-02 Thread Craig Citro
But you would be taking a module that will compile and making it uncompilable. You're absolutely right, and since I definitely *don't* think that the program raise TypeError should cause a CompileError, you could say it's safer to have a simple rule like vaild syntax = will compile -- it's

Re: [Python-Dev] Can Python implementations reject semantically invalid expressions?

2010-07-02 Thread Craig Citro
1/0 is much faster to type than raise SomeError and serves the same purpose sometimes for debugging purposes.  Let's not forget that not all code is written for eternity :) Doesn't raise do the same thing for just two extra characters? I agree that not all code lives forever -- but I bet we

Re: [Python-Dev] Can Python implementations reject semantically invalid expressions?

2010-07-02 Thread Craig Citro
To test that adding a string to an integer raises TypeError at runtime. That is, something along the lines of:  with self.assertRaises(TypeError):     1 + 1 Well, this would just mean the test suite would have to change -- that test would become something like with

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 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] PEP 3146: Merge Unladen Swallow into CPython

2010-02-02 Thread Craig Citro
Done. The diff is at http://codereview.appspot.com/186247/diff2/5014:8003/7002. I listed Cython, Shedskin and a bunch of other alternatives to pure CPython. Some of that information is based on conversations I've had with the respective developers, and I'd appreciate corrections if I'm out of