apache / pulsar-client-python

Apache Pulsar Python client library
https://pulsar.apache.org/
Apache License 2.0
51 stars 40 forks source link

Issue #31 - Access name attribute of any type object #92

Closed erichare closed 1 year ago

erichare commented 1 year ago

Addresses Issue #31 - we should access a string representation of the given object rather than assuming that the object itself can be concatenated with a string.

erichare commented 1 year ago

@BewareMyPower i agree about CustomEnum. I was less sure about the Array change in that PR - The array can be of primitive types, such as a str itself, right? do we need to check whether there exists a __name__ attribute, otherwise just try to coerce directly to a str if not? Basically just wasn't sure if we can always assume it'll have that attribute... the original PR seemed to be closed and requested not to merge because of that same issue

BewareMyPower commented 1 year ago

do we need to check whether there exists a name attribute,

If so, we can create a helper function to return s.__name__ or fall back to str(s).

erichare commented 1 year ago

@BewareMyPower thanks! I just pushed a new commit which tries to backport those other instances from the closed PR, using a helper function. Let me know if this looks okay.