[00:13:01] ** Maniac has left IRC ("ChatZilla 0.9.63a [Mozilla rv:1.6/20040206]") [02:04:45] ** gbay has joined us [02:20:31] ** gpciceri has joined us [04:03:49] [connected at Tue Jun 1 04:03:49 2004] [04:03:49] <> *** Looking up your hostname... [04:03:49] <> *** Checking ident [04:03:49] <> *** Found your hostname [04:04:20] <> *** No identd (auth) response [04:04:20] <> *** Your host is wells.freenode.net[wells.freenode.net/6667], running version dancer-ircd-1.0.35 [04:04:20] [I have joined #peak] [04:04:20] ** wells.freenode.net set the topic to peak - Python Enterprise Application Toolkit | http://peak.telecommunity.com | alpha3 is out !!! [04:12:05] ** gpciceri has left IRC (Read error: 110 (Connection timed out)) [04:12:15] ** gpciceri has joined us [06:14:54] ** gpciceri has left IRC ("Client exiting") [06:39:13] ** gbay has left IRC ("It's not like I'm leaving or anything...") [07:21:33] jack-e|away is now known as jack-e [07:57:10] ** sremington_ has left IRC ("bye") [08:45:23] ** rdmurray has joined us [08:57:37] ** sremington has joined us [09:00:24] ** rdmurray has left IRC ("User disconnected") [09:07:20] ** rdmurray has joined us [11:32:39] ** hazmat has joined us [12:00:43] ** Maniac has joined us [13:01:02] ** hazmat has left IRC (Read error: 110 (Connection timed out)) [13:59:20] jack-e is now known as jack-e|away [14:07:22] ** gpciceri has joined us [15:21:42] ** hazmat has joined us [15:21:45] ** hazmat_ has joined us [15:24:41] ** hazmat_ has left IRC (Client Quit) [15:24:41] ** hazmat has left IRC (Client Quit) [15:53:14] ** _jpl_ has joined us [15:55:13] ** panix- has joined us [15:55:18] anyone here? [15:57:29] No. [15:58:07] nah [15:59:00] chillywi1ly is now known as chillywilly [16:01:41] well, just a quick python question... does anyone know how to modify the contents of globals, *globally* [16:01:46] I know that question sounds a bit off... [16:02:02] but, basically, I want to set a __metaclass__ so that all future imported objects will use that metaclass. [16:02:45] Well, if you modify globals, I believe that is a global effect. [16:02:53] unfortunately, it seems not to. [16:03:08] Hmm. I could have sworn that zope stuff things into globals that way (which bugged me). [16:03:12] that doesn't make sense [16:03:14] if I, for example, do --> [16:03:14] s/stuff/stuffed/ [16:03:25] globals()['__metaclass__'] = MyType [16:03:41] from somemodule import SomeClass [16:03:48] SomeClass will not have a __metaclass__ [16:04:02] rdmurray: I am sure that Zope does it somehow :) [16:04:06] just don't know how. [16:04:11] ask in #python or #zope :P [16:04:16] heh, sure. [16:04:32] all the smart people are idling [16:04:32] I don't think you can set __metaclass__ that way. [16:04:50] oh, except for rdmurray and chillywilly they're probably smart [16:04:56] :) [16:04:57] cause each type has its own __metalclass__ [16:05:07] __metaclass__ is a module variable, not a global, if I understand right. [16:05:09] __metaclass__ too [16:05:22] well, if it is set in globals() it has an effect on local classes [16:05:26] so thats not true [16:05:29] what's so hard about having one extra line ;) [16:05:45] though, if I print globals() inside each module, then I see that each seems to have its own unique copy. [16:05:55] panix-: how do you know? How do you get it set in globals? [16:06:02] I set it just as above [16:06:13] globals()['__metaclass__'] = MyType [16:06:17] Um, but you said that didn't work. I'm confused. [16:06:32] no, it works on local classes, not on classes from imported modules. [16:06:43] Well, of course not. [16:06:58] The imported class takes its metaclass from its module. [16:07:03] imports don't change metaclass. [16:07:04] right, hence the problem [16:07:52] what seems to be happening is that the builtin 'globals' function gives me a copy, not the *true* globals dictionary [16:08:02] so that each module has its own globals [16:08:21] what if you use __import__ and pass in the globals? [16:08:52] or wrap it up in some function or what not [16:08:56] well, that works great. [16:09:03] but, I don't want to do it that way :) [16:09:11] sucks to be you ;) [16:09:21] I want existing python modules to automagically take on my metaclass [16:09:22] indeed :) [16:09:35] I am doing some pretty hefty AOP trickery here :) [16:09:50] hmmmm [16:10:03] I can set it on __main__ and see it inside the module [16:10:11] but, __metaclass__ doesn't take effect from there. [16:10:16] you can repolace __import__ with your own implementation [16:10:17] I think [16:10:22] replace too [16:10:22] thats a decent idea. [16:12:17] http://docs.python.org/lib/built-in-funcs.html#l2h-6 [16:12:46] I really would like to figure out where globals() is getting its variables from. [16:13:30] the module? [16:13:49] well, I mean the actual dictionary [16:14:08] the globals() builtin function is copying some dictionary and returning it [16:14:14] I want access to that dictionary :) [16:14:26] but, I think that overriding __import__ will probably work. [16:14:41] I found what zope does. It modifies __builtin__. [16:15:46] Very evil :) [16:15:49] heh [16:15:52] of course :) [16:15:55] link to CVS? [16:16:06] Nah, I have it installed. [16:16:12] gotcha [16:16:13] ZODB/Transaction.py [16:16:27] import __builtin__ [16:16:40] __builtin__.get_transaction = get_transaction [16:16:51] hmmm, is __metaclass__ in the module's __dict__ ? [16:16:52] del __builtin__ [16:18:40] well, __metaclass__ can be located there. [16:22:04] ** hazmat has joined us [16:23:55] <_jpl_> Doesn't each module have it's own global scope? [16:24:02] _jpl_: yes. [16:24:07] <_jpl_> Or is that considered module-level scope? [16:24:19] globals() == module level scope. [16:24:39] and, unless you are inside a function or class, locals() == globals() [16:25:01] <_jpl_> Right, so then globals() in the importing scope will not be the same as that of the imported module. [16:30:19] hmm [16:30:21] interesting [16:30:37] well, I overwrote __builtins__.globals with my own function [16:30:43] and managed to shove the metaclass into there [16:30:55] but, now the module sees the metaclass, but doesn't actually use it :) [16:34:42] ** Maniac has left IRC ("Client exiting") [16:40:43] <_jpl_> I wonder if you could do some tricks with the 'new' module. [16:41:47] I am actually trying to override __import__ right now to see if that will do the trick [16:42:30] <_jpl_> That might be the right direction to go, but then you should look at the 'imp' module. [16:45:09] I looked at it a little... looks kinda complicated :) [16:53:20] arg... overriding __import__ won't work. [16:53:23] I will have to use imp [16:54:26] <_jpl_> What will you do if an object already has a custom metaclass? [17:00:12] overwrite it. [17:00:28] but, for my case, this should be okay [17:00:52] actually, it seems that the local one will hold. [17:00:56] it takes preference over mine. [17:00:57] which is good. [17:07:19] you can use imp to implement __import__ supposedly ;) [17:10:37] chillywilly: yes [17:10:43] that is what I am going to have to do. [17:10:58] ah well ;) [17:11:00] the problem is that I need it to be exactly like import so that I don't break anything... [17:11:03] such is life I guess [17:11:04] kinda scary [17:11:06] indeed. [17:11:19] ** gpciceri has left IRC ("Client exiting") [17:11:24] I am considering just forcing things to explicitly import and reference the metaclass, but I don't like that very much... [17:19:56] ** gbay has joined us [17:26:58] ** sremington has left IRC ("bye") [17:36:33] ah hah! [17:36:36] got it to work :) [17:36:46] w00t [17:37:02] I did it without needing imp too [17:37:29] just overrode __import__ [17:37:41] dynamically created a class that used my metaclass [17:37:52] then forced any imported objects to subclass that class [17:39:15] still not perfect. [17:39:18] but, good enough for now [17:39:20] time to go home! [17:39:21] ** panix- has left IRC (Remote closed the connection) [17:55:59] That's how p [17:55:59] PEAK does it, AFAIK. [17:56:06] Oh, he's gone. [17:56:25] doh [17:59:23] ** gpciceri has joined us [18:14:18] ** gpciceri has left IRC ("Client exiting") [18:30:29] ** sremington has joined us [18:31:34] ** hazmat has left IRC (Read error: 110 (Connection timed out)) [18:50:19] ** gbay has left IRC ("It's not like I'm leaving or anything...") [19:00:56] ** Maniac has joined us [19:02:52] ** rdmurray has left IRC ("User disconnected") [19:14:00] ** _jpl_ has left us [19:28:46] ** Maniac has left IRC ("ChatZilla 0.9.63a [Mozilla rv:1.6/20040206]") [19:38:05] ** philips has left us [19:38:07] ** Maniac has joined us [19:39:06] ** hazmat has joined us [20:18:28] ** hazmat has left IRC (Read error: 110 (Connection timed out)) [21:55:35] ** rdmurray has joined us