4 ms·
You can do stuff like this, Java devs in particular get freaked out by this sort of thing in my experience. (Forgive the formatting) import foo foo.auth("admi
by willcipriano 6y ago
You can do stuff like this, Java devs in particular get freaked out by this sort of thing in my experience. (Forgive the formatting)
import foo
foo.auth("admin", "badpass")
returns False
def new_auth(user, pass):
. . . .return True
foo.auth = new_auth
foo.auth("admin", "badpass")
now returns True
- neolog 6y agoThat's called monkeypatching and it's a last-resort hack, not something you'd just use willy-nilly in production code.