Python Newbie

Steven D'Aprano steve+comp.lang.python at
Mon Feb 25 01:42:56 CET 2013

On Sun, 24 Feb 2013 16:08:01 -0500, Roy Smith wrote:

> In article <mailman.2438.1361739512.2939.python-list at>,
>  Chris Angelico <rosuav at> wrote:
>> > no need to remember what's an object and what's not -- everything is
>> > an object
> Well, not quite everything.  If I write:
> if foo:
>    do_this()
>    and_this()
> the code block making up the body of the "if" statement is not an
> object.  In some languages, it is.

In Python, that code block isn't any *thing*. It's merely a small part of 
the enclosing code block, which *is* an object.

When we say "everything is an object" in Python, we're talking about 
values, not arbitrary language constructs. The "*3" bit of "y = x*3" is 
not a value, a for-loop is not a value, and the delay you experience when 
you call time.sleep(30) is not a value, so none of these things are 
objects. This is not to reduce the importance of these things as 
programming concepts, but they aren't the kind of things we mean when we 
say everything is an object.


More information about the Python-list mailing list