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

Update input_text.py #984

Merged
merged 1 commit into from
Feb 11, 2022
Merged

Update input_text.py #984

merged 1 commit into from
Feb 11, 2022

Conversation

rtk-rnjn
Copy link
Contributor

@rtk-rnjn rtk-rnjn commented Feb 10, 2022

Summary

Too many argument in __init__. Change *args to **kwargs.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)

@stijndcl
Copy link
Contributor

stijndcl commented Feb 10, 2022

Isn't this a breaking change (the checkbox in the PR is unchecked)? Anyone code written in the old way (assuming args instead of kwargs) will no longer work because it raises a TypeError.

Example:

class Test:
    def __init__(self, *, x, y=None, z=None):
        pass


# Using the old way with positional args
Test(1, 2)
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    Test(1, 2)
TypeError: __init__() takes 1 positional argument but 3 were given

@krittick krittick mentioned this pull request Feb 10, 2022
7 tasks
@krittick
Copy link
Contributor

Isn't this a breaking change (the checkbox in the PR is unchecked)? Anyone code written in the old way (assuming args instead of kwargs) will no longer work because it raises a TypeError.

Example:

class Test:
    def __init__(self, *, x, y=None, z=None):
        pass


# Using the old way with positional args
Test(1, 2)
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    Test(1, 2)
TypeError: __init__() takes 1 positional argument but 3 were given

It's a new enough feature that it's not as big of a deal compared to changing this for an older feature.

@krittick krittick merged commit b716a01 into Pycord-Development:master Feb 11, 2022
@rtk-rnjn rtk-rnjn deleted the patch-1 branch February 11, 2022 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants