Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- """
- "Descriptors look weird. They're attached to the class and the methods
- have a funky signature."
- This is from a talk given by a hacker at twitter
- This is for python 3 world
- """
- class MyDescriptor(object):
- def __get__(self, obj, type):
- print self, obj, type
- def __set__(self, obj, val):
- print "Got %s" % val
- class Myclass(object):
- x = MyDescriptor() # Attached at class definition time!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement