creating class objects inside methods
pavlovevidence at gmail.com
Sun Oct 4 21:37:11 CEST 2009
On Oct 4, 11:56 am, Benjamin Kaplan <benjamin.kap... at case.edu> wrote:
> On Sun, Oct 4, 2009 at 2:44 PM, horos11 <horo... at gmail.com> wrote:
> > (
> > ps - an aside, but what was the rationale behind only displaying one
> > error at a time on trying to run a script? I typically like to run a
> > compilation phase inside my editor (vim), get a list of errors, and
> > then go to each one and fix them.
> > And how do you just check a script's syntax without running it
> > anyways?
> > )
> Because these aren't compile-time errors. Python has no compilation
> phase- every statement (including def and class) is an executable
> statement and it gets turned into byte code at execution time. Just
> like any other language, when Python hits a runtime error, it stops.
No, there is a compile phase, but the only error that is raised at
compile-time is SyntaxError. Because of Python's dynamicism the
compiler knows hardly anything about the objects at compile-time
(except in a few cases involving constants, which Python takes
advantage of to do some compile-time constant folding).
More information about the Python-list