MonkeeSage wrote: > 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.
no, I don't know it. how do I define something into the top-level namespace? I assume I could place it into the root-package of my project, into the __init__ function. But how do I place it within my computers python installation (the big init)? > 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): ... I am aware of this technique. But I want to modify existent classes, without touching their code. > > 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? I am not evaluating Python, I've started using it: http://case.lazaridis.com/wiki/Lang http://dev.lazaridis.com/base - I've noticed some interesting code on you website: " class file(file): def reopen(self, name=None, mode='w', bufsize=None): ... fh = file('test.txt', 'rb') print fh # <open file 'test.txt', mode 'rb' at 0xb7c92814> fh.reopen(mode='wb') " http://rightfootin.blogspot.com/2006/09/ruby-reopen.html does this mean that I can add a method to a class in a similar way with ruby? (by using class class-name(class-name): ) but the limitation is that I cannot do this with the python build-in types?: http://rightfootin.blogspot.com/2006/08/of-rocks-and-reptiles.html . -- http://mail.python.org/mailman/listinfo/python-list