half object/half dictionary

Manuel M. Garcia mgarcia at cole-switches.com
Mon Dec 9 18:53:07 EST 2002


Thanks so much!

It is becoming clearer (still hazy, but better)

My mind still boggles at why we would need 'cls' in the following
statements:

class meta1(type):
	def __new__(cls, classname, bases, classdict):
		return type.__new__(cls, classname, bases, classdict)

Here is an example of a metaclass where 'cls' is used and not just
passed along to type.__new__ :

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164

but I can't say I really understand this.

Does type.__new__(cls, classname, bases, classdict) do anything with
'cls'?

Manuel



More information about the Python-list mailing list