I was looking at Simon Burton's Povray.py code (part of pypov) and saw
this line:
globals()[name] = type( name, (KWItem,), {} ) # nifty :)

where 'KWItem' was a class. It did seem nifty, but it was unclear to me
what was happening.

I went to python.org's online documentation which said that type()
takes one argument. So I fired up python:
>>> type(42)
<type 'int'>
>>> type("x", (type(42),), {})
<class '__main__.x'>

OK, It appears that type() with 3 arguments constructs a class. Is this
documented somewhere? If not can someone explain what is going on?
james

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

Reply via email to