BinaryPayloadBuilder.to_string type hint #1518
Replies: 4 comments 1 reply
-
type hinting with bytes is a good idea. renaming to to_bytes is a good idea (remember to to add it to API_changes.rst) str is used to e.g. print the object, but should not replace a to_* method. |
Beta Was this translation helpful? Give feedback.
-
if your preference is encode() it's ok with me. |
Beta Was this translation helpful? Give feedback.
-
I agree the type hint should be bytes, but do not have a preference on Just for information, if you set the following in
|
Beta Was this translation helpful? Give feedback.
-
Okay the PR is now merged! One comment, is there's also I more leave this as food for thought... it might be slick to use assert builder.encode() == bytes(builder) |
Beta Was this translation helpful? Give feedback.
-
pymodbus==3.2.2
'sBinaryPayloadBuilder.to_string
actually returnsbytes
.Two questions:
bytes
?encode
orto_bytes
, since it doesn't return a string?BinaryPayloadBuilder.__str__
already exists, so I would thinkto_string
is redundantBeta Was this translation helpful? Give feedback.
All reactions