[Python-Dev] Challenge: Please break this! (a.k.a restricted mode revisited)

Robert Collins robertc at robertcollins.net
Mon Apr 11 03:08:54 EDT 2016

On 11 April 2016 at 13:49, Tres Seaver <tseaver at palladion.com> wrote:
> Hash: SHA1
> On 04/10/2016 06:31 PM, Jon Ribbens wrote:
>> Unless someone knows a way to get to an object's __dict__ or its type
>> without using vars() or type() or underscore attributes...
> Hmm, 'classmethod'-wrapped functions get passed the type.

yeah, but to access that you need to assign the descriptor to the type
- circular loop. If you can arrange that assignment its easy:

thetype = []
class gettype:
    def __get__(self, obj, type=None):
        thetype.append((obj, type))
        return None

classIwant.query = gettype()

but you've already gotten to classIwant there.


Robert Collins <rbtcollins at hpe.com>
Distinguished Technologist
HP Converged Cloud

More information about the Python-Dev mailing list