◐ Shell
clean mode source ↗

Message 53548 - Python tracker

Logged In: YES 
user_id=11850

True. Would it be a security problem to use getattr inside a 
specialized constructor? For example,

def get_method(object, name):
    klass = object.__class__
    fn = getattr(klass, name)
    return new.instancemethod(fn, object, klass)

This would be difficult to abuse as a general getattr 
replacement, because new.instancemethod would fail in most 
cases other than the intended one.