Upload
brianna-bowman
View
212
Download
0
Embed Size (px)
Citation preview
Developers’ Day 2002
Making classes look like types (and vice versa)
Or…
Developers’ Day 2002
Compound W for Python’s object model
Or…
Developers’ Day 2002
Goading Guido into describing something only he (fully)
understands
4
(C) 2002 Zope Corp.
New stuff…New stuff…
• properties
• descriptors (?)
• old-style classes (ok, old stuff)
• new builtins– object, super, property, staticmethod,
classmethod, dict, …
• new-style classes
• method resolution order
5
(C) 2002 Zope Corp.
What about metaclasses…?What about metaclasses…?
6
(C) 2002 Zope Corp.
What about metaclasses…?What about metaclasses…?
>>> brain.kaboom()
7
(C) 2002 Zope Corp.
More new stuff…More new stuff…
• __getattribute__()
• property interface– __get__()
– __set__()
– __delete__()
• __slots__
• __mro__
• __new__()
8
(C) 2002 Zope Corp.
Issues…Issues…
• Status of PEPs 252, 253, 254
• More syntactic support– staticmethod
– classmethod, etc…
• Limitations in extending C types– Adding C slots
• Documenting everything
9
(C) 2002 Zope Corp.
Questions…Questions…
• Has anybody used it for real?
• Usability?
• Functionality?
• Promoting this stuff from experimental status
• Getting rid of classic classes?
• Performance?
10
(C) 2002 Zope Corp.
References…References…
http://www.python.org/2.2/descrintro.html
http://python.sf.net/peps/pep-0252.html
http://python.sf.net/peps/pep-0253.html
http://python.sf.net/peps/pep-0254.html
Putting Metaclasses to Work: A New Dimension in Object-Oriented Programming, by Ira R. Forman and Scott H. Danforth. Addison-Wesley, 1999, ISBN 0-201-43305-2.