[Python-Dev] Can Python implementations reject semantically invalid expressions? (original) (raw)
Mark Dickinson dickinsm at gmail.com
Fri Jul 2 09:22:43 CEST 2010
- Previous message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Next message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jul 2, 2010 at 7:55 AM, Craig Citro <craigcitro at gmail.com> wrote:
Ok, I'm obviously being silly here, but sure you can:
dis.dis("raise TypeError()") 0 <114> 26977 3 <115> 8293 6 IMPORTSTAR 7 SETUPEXCEPT 25968 (to 25978) 10 <69> 11 <114> 28530 14 <114> 10536 dis.dis("1 + '1'") 0 <49> 1 SLICE+2 2 STORESLICE+3 3 SLICE+2 4 <39> 5 <49> 6 <39>
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()'.
Mark
- Previous message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Next message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]