Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-22 Thread Ilias Lazaridis
Steve Holden wrote: > Michele Simionato wrote: > > (I don't believe I am responding to a notorious troll ...) > > > Believe it. You are. Ain't life a bitch? :-) > > > One (bad) solution is to write in your sitecustomize.py the following: > > > > $ echo /usr/lib/python/sitecustomize.py > > import __

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Ilias Lazaridis
George Sakkis wrote: > Ilias Lazaridis wrote: > > > I like to add a method "writeDebug(self, msg)" to all (or the most > > possible) classes in the system. > > > > How do I do this? > > > > * with new style classes > > * with old style classes > > Short answer: you can't do it for builtin or extens

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Steve Holden
Michele Simionato wrote: > (I don't believe I am responding to a notorious troll ...) > Believe it. You are. Ain't life a bitch? :-) > One (bad) solution is to write in your sitecustomize.py the following: > > $ echo /usr/lib/python/sitecustomize.py > import __builtin__ > > class Object(object)

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Michele Simionato
(I don't believe I am responding to a notorious troll ...) One (bad) solution is to write in your sitecustomize.py the following: $ echo /usr/lib/python/sitecustomize.py import __builtin__ class Object(object): def debug(self): print 'some debug info' __builtin__.object = Object th

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Ilias Lazaridis
e it behind some pretty > ## object attributes :) > ## > ## YMMV - and don't complain if you don't > ## like it; I wrote it for ME, not you > ## > ## Jordan Callicoat < [EMAIL PROTECTED] > > > ## some global methods so we can use them > ## to set up the clas

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread MonkeeSage
Ilias Lazaridis wrote: > no, I don't know it. OK...so how do you evaluate a language when you don't know its basic operations? Hmmm, sounds fishy. > 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__ > functio

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Ilias Lazaridis
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

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread George Sakkis
Ilias Lazaridis wrote: > I like to add a method "writeDebug(self, msg)" to all (or the most > possible) classes in the system. > > How do I do this? > > * with new style classes > * with old style classes Short answer: you can't do it for builtin or extension types: >>> list.writeDebug = lambda m

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Steve Holden
Ilias Lazaridis wrote: > MonkeeSage wrote: > >>Ilias Lazaridis wrote: >> >>>How do I do this? >> >>It's easy: >> >>def writeDebug(msg): >> print "I do not debug things, I _evaluate_ with professionals on the >>industries! See ticket 547!\n" \ >>"Oh yeah, and %s" % msg > > > where do I p

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread MonkeeSage
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 a

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Ilias Lazaridis
MonkeeSage wrote: > Ilias Lazaridis wrote: > > How do I do this? > > It's easy: > > def writeDebug(msg): > print "I do not debug things, I _evaluate_ with professionals on the > industries! See ticket 547!\n" \ > "Oh yeah, and %s" % msg where do I place this function... > ... > class F

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Ilias Lazaridis
Diez B. Roggisch wrote: > Ilias Lazaridis wrote: > > Ilias Lazaridis wrote: > >> I understand that I can use __metaclass__ to create a class which > >> modifies the behaviour of another class. > >> > >> How can I add this metaclass to *all* classes in the system? > >> > >> (In ruby I would alter th

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread MonkeeSage
Ilias Lazaridis wrote: > How do I do this? It's easy: def writeDebug(msg): print "I do not debug things, I _evaluate_ with professionals on the industries! See ticket 547!\n" \ "Oh yeah, and %s" % msg ... class Foo: writeDebug("how can I configure the interpreter for understand Klingo

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Diez B. Roggisch
Ilias Lazaridis wrote: > Ilias Lazaridis wrote: >> I understand that I can use __metaclass__ to create a class which >> modifies the behaviour of another class. >> >> How can I add this metaclass to *all* classes in the system? >> >> (In ruby I would alter the "Class" class) > > I got confused fr

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Ilias Lazaridis
Ilias Lazaridis wrote: > I understand that I can use __metaclass__ to create a class which > modifies the behaviour of another class. > > How can I add this metaclass to *all* classes in the system? > > (In ruby I would alter the "Class" class) I got confused from the discussion about __metaclass_

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Georg Brandl
Diez B. Roggisch wrote: >>> >>> I think '__metaclass__ = whatever' affects only the creation of >>> classes that >>> would otherwise be old-style classes? >> >> Wrong. >> >> If you set __metaclass__ = type, every class in that module will be >> new-style. >> >> If you set __metaclass__ = MyCla

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Damjan
>>> __metaclass__ = whatever >>> >>> at the top of each module whose classes are to get the new behavior. >> >> I think '__metaclass__ = whatever' affects only the creation of classes >> that would otherwise be old-style classes? > > Wrong. > > If you set __metaclass__ = type, every class in th

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-19 Thread Diez B. Roggisch
>> >> I think '__metaclass__ = whatever' affects only the creation of >> classes that >> would otherwise be old-style classes? > > Wrong. > > If you set __metaclass__ = type, every class in that module will be > new-style. > > If you set __metaclass__ = MyClass, and MyClass inherits from , eve

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-18 Thread Georg Brandl
Damjan wrote: >>> I understand that I can use __metaclass__ to create a class which >>> modifies the behaviour of another class. >>> >>> How can I add this metaclass to *all* classes in the system? >>> >>> (In ruby I would alter the "Class" class) >> >> You'd have to set >> >> __metaclass__ = w

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-18 Thread Ilias Lazaridis
Calvin Spealman wrote: > On 18 Sep 2006 20:23:03 -0700, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > > Steve Holden wrote: > > > Ilias Lazaridis wrote: > > ... > > > > http://www-128.ibm.com/developerworks/linux/library/l-pymeta.html > > > > > > > > I am not so much interested in old-style, as is s

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-18 Thread Calvin Spealman
On 18 Sep 2006 20:23:03 -0700, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > Ilias Lazaridis wrote: > ... > > > http://www-128.ibm.com/developerworks/linux/library/l-pymeta.html > > > > > > I am not so much interested in old-style, as is start production with > > > python 2.4

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-18 Thread Ilias Lazaridis
Steve Holden wrote: > Ilias Lazaridis wrote: ... > > http://www-128.ibm.com/developerworks/linux/library/l-pymeta.html > > > > I am not so much interested in old-style, as is start production with > > python 2.4 (possibly even with python 2.5). > > > > The fact remains that you won't be able to aff

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-18 Thread Paul McGuire
"Calvin Spealman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 17 Sep 2006 09:22:16 -0700, Ilias Lazaridis <[EMAIL PROTECTED]> > wrote: >> I understand that I can use __metaclass__ to create a class which >> modifies the behaviour of another class. >> >> How can I add this met

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-18 Thread Steve Holden
Ilias Lazaridis wrote: > Damjan wrote: > I understand that I can use __metaclass__ to create a class which modifies the behaviour of another class. How can I add this metaclass to *all* classes in the system? (In ruby I would alter the "Class" class) >>> >>>You'd have to

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-17 Thread Ilias Lazaridis
Damjan wrote: > >> I understand that I can use __metaclass__ to create a class which > >> modifies the behaviour of another class. > >> > >> How can I add this metaclass to *all* classes in the system? > >> > >> (In ruby I would alter the "Class" class) > > > > You'd have to set > > > > __metaclass

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-17 Thread Damjan
>> I understand that I can use __metaclass__ to create a class which >> modifies the behaviour of another class. >> >> How can I add this metaclass to *all* classes in the system? >> >> (In ruby I would alter the "Class" class) > > You'd have to set > > __metaclass__ = whatever > > at the top

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-17 Thread Georg Brandl
Ilias Lazaridis wrote: > I understand that I can use __metaclass__ to create a class which > modifies the behaviour of another class. > > How can I add this metaclass to *all* classes in the system? > > (In ruby I would alter the "Class" class) You'd have to set __metaclass__ = whatever at the

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-17 Thread Calvin Spealman
On 17 Sep 2006 09:22:16 -0700, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > I understand that I can use __metaclass__ to create a class which > modifies the behaviour of another class. > > How can I add this metaclass to *all* classes in the system? > > (In ruby I would alter the "Class" class) Th

CONSTRUCT - Adding Functionality to the Overall System

2006-09-17 Thread Ilias Lazaridis
I understand that I can use __metaclass__ to create a class which modifies the behaviour of another class. How can I add this metaclass to *all* classes in the system? (In ruby I would alter the "Class" class) . http://lazaridis.com -- http://mail.python.org/mailman/listinfo/python-list