On Tue, Jul 13, 2010 at 8:03 PM, chad <cdal...@gmail.com> wrote: > Given the following code... > > #!/usr/bin/python > > class cgraph: > def printme(self): > print "hello\n" > > x = cgraph() > x.printme() > > > Does the function print() exist in the cgraph namespace or the > printme() one?
Neither. It exists in the built-ins namespace along with the rest of the built-in functions like len(), zip(), hex(), etc. The built-ins is the namespace of last resort; it's the last one to be consulted when trying to resolve a name in Python. You can inspect it via __builtins__ Also, in your example, print is being used as a statement (i.e. part of the language syntax), not a function; note the odd lack of parentheses when "calling" it. print was changed to a regular function in Python 3.x. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list