On Mar 7, 4:39 pm, DBak <[EMAIL PROTECTED]> wrote: > On Mar 7, 1:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote: > > > However I can't do this, because, of course, the name Tree isn't > > > available at the time that the classes _MT and _Node are defined, so > > > _MT and _Node can't inherit from Tree. > > > Not only is the name not defined, the class doesn't even exist yet. > > Yes, but, well - it certainly isn't usable yet, but some object (that > will be the class when it is finished) is being built (its __dict__ is > being populated, etc.) - so there's an object pointer available inside > the interpreter that could be put somewhere. But this is pedantic - > you're right, the class really isn't available until after the class > statement.
There is no obvious solution-- What do you mean? If there are any at all, there is significant competition without clear winners. dict dictA: membA= 0 membB= 0 dict dictB: membC= 0 But, if you try to nest them, do you want the rest of the 'dict' at its outer level evaluated (that's your 'here is the crux'), or only that point so far? dict dictO: membA= 0 dict membB: membC= 0 membD= membE membE= 0 So, you can't refer to it at all. Especially if membE is defined in outer scope. > class Tree(object): > ...class _MT(Tree): Can you use a metaclass--- postponedinstantiating (since a class is an instance of A PARTICULAR THING.) <throat clear> And one of us could even lobby the wigs to put a metaclass in the standard library. What's the first to go? <throat.clear()>. If you could have any one metaclass in it, what would it be? The additions with the biggest pull are the ones that can make money really easily for Python speakers. Yes, money. How long is the workaround? In this case, if you want _MT in Tree (or the analogous pair, without loss of generality), you can still get it done (you know where to find me), thanks to Python. You just sacrifice how closely the final product (code), resembles the concept. Yes, that idea would make class definitions more explanitorily powerful-- have more acute explanations. But you need to assign meaning to a syntax element, which is done over time. If Python is a hybrid between C and ML, what is the hybrid between Python and XML? -- http://mail.python.org/mailman/listinfo/python-list