CONSTRUCT - Adding Functionality to the Overall System
MonkeeSage
MonkeeSage at gmail.com
Tue Sep 19 13:22:51 EDT 2006
Ilias Lazaridis wrote:
> where do I place this function...
The place where you want it to be.
> ...thus it becomes available within class "Foo" and all other Classes?
Anything defined in the top-level (i.e., the sys.modules['__main__']
namespace) is accessible in every scope...but I assume you already know
that.
You could also use a super-duper super class from which to derive all
your other classes, and add/replace any methods you want there:
class lazaridis(object):
def evaluate(self, community):
if 1 is 1:
print "Evaluating %s... Result: failed!" % community
class Foo(lazaridis, str):
pass
f=Foo('This has been a test of the lazaridis evaluation system')
f.evaluate('Python')
f.evaluate('Ruby')
f.evaluate('Java')
print f
> Something like a central import?
That would probably be the most logical thing to do.
But again, I assume you already know all this, so why are you asking?
Is this part of the evaluation process?
Regards,
Jordan
More information about the Python-list
mailing list