Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Expose Channel._type publicly to avoid multiple isinstance checks #2185

Closed
SnowyLuma opened this issue May 24, 2019 · 0 comments

Comments

@SnowyLuma
Copy link
Contributor

commented May 24, 2019

The Problem

Trying to find the ChannelType value for a channel currently involves going through each existing channel type and performing an isinstance check to see if it matches the channel.

As channels already have the _type attribute/property it would be very convenient to expose it publicly, as the checks above could be replaced with a simply attribute access.

The Ideal Solution

_type is renamed to type and returns a ChannelType instead of the channel type value.

The Current Solution

Cycling through possible channel types and performing an isinstance check.

Summary

Expose the _type attribute/property of channels for less complex code.

@Rapptz Rapptz added the suggestion label May 24, 2019

@Rapptz Rapptz self-assigned this May 24, 2019

@Rapptz Rapptz added this to the v1.2 milestone Jun 9, 2019

@Rapptz Rapptz closed this in 7e2da1c Jun 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.