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 self.assertRaises

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

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'

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 actuall

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

2010-07-01 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 <115>8293 6 IMPORT_STAR 7 SETUP_EXCEPT25968 (to 259

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] 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 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] 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 ou