Gregory Ewing wrote:
On 07/05/2010 11:07 AM, Anthra Norell wrote:

I try to use "new.new.classobj (name, baseclass, dict)" and have no clue
what the "dict" of the current name space is.

Are you sure that's what you really want to know? The
'dict' argument to classobj() defines the attributes
that you want the new class to have. It's not meant
to be the namespace in which the code creating the
class is executing.

No indeed I'm not sure. The doc explains the argument "dict" as "name space", a term I associated with the enclosing module's name space, because it is also visible from inside enclosed blocks. But how right you are! Passing locals () works fine inasmuch as the constructor doesn't complain. Looking subsequently at the class attributes with dir (c) or c.__dict__keys (), however, dumps the entire inventory of the module in addition to the attributes of the base class. Clearly, that can't be right. So, thanks to you! I very much appreciate the guidance along the right path.

Frederic
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to