Re: python namespace question

2010-07-13 Thread alex23
chad wrote: > I could care less about the extra blank line. I guess I was just more > concerned about the namespace question. Which is why Steven spent far more time answering that question than commenting on newline handling. Now say 'thank you'. -- http://mail.python.org/mailman/listinfo/pyth

Re: python namespace question

2010-07-13 Thread Steven D'Aprano
On Tue, 13 Jul 2010 20:52:31 -0700, Chris Rebert wrote: > 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__ Avoid __builtins__ as it is an implementation detail. The difference between

Re: python namespace question

2010-07-13 Thread Chris Rebert
On Tue, Jul 13, 2010 at 8:03 PM, chad 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 exis

Re: python namespace question

2010-07-13 Thread chad
On Jul 13, 8:37 pm, Steven D'Aprano wrote: > On Tue, 13 Jul 2010 20:03:14 -0700, chad 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 i

Re: python namespace question

2010-07-13 Thread Steven D'Aprano
On Tue, 13 Jul 2010 20:03:14 -0700, chad 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? What

Re: python namespace question

2010-07-13 Thread Shashwat Anand
On Wed, Jul 14, 2010 at 8:33 AM, chad wrote: > Given the following code... > > #!/usr/bin/python > > class cgraph: >def printme(self): >print "hello\n" > No need to do print "hello\n", python is not C, print "hello" prints hello with a newline. Try it on interpretor. > > x = cgraph

python namespace question

2010-07-13 Thread chad
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? -- http://mail.python.org/mailman/listinfo/python-list