You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to try to implement hashlib (PR will follow).
For now I have implemented Type, module, module method and some "magic methods", but I cannot figure out how to implement object methods such as update, hexdigest etc.
This isn't particularly elegant at the moment, but see py/generator.go for an example. You basically add the method objects to the type's Dict by hand.
GeneratorType.Dict["send"] =MustNewMethod("send", func(selfObject, valueObject) (Object, error) {
returnself.(*Generator).Send(value)
}, 0, "send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")
Activity
[-]How to implement object methods?[/-][+][Question] How to implement object methods?[/+]ncw commentedon Aug 28, 2018
This isn't particularly elegant at the moment, but see
py/generator.gofor an example. You basically add the method objects to the type's Dict by hand.drew-512 commentedon Feb 22, 2022
recommend @sbinet close -- addressed w/ #163