Skip to content

bpo-39994: Removed redundant code.#19046

Closed
ghost wants to merge 1 commit into
masterfrom
unknown repository
Closed

bpo-39994: Removed redundant code.#19046
ghost wants to merge 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Mar 17, 2020

Copy link
Copy Markdown

Since self._dispatch has dict.__repr__: self._pprint_dict the elif block is not needed.

https://bugs.python.org/issue39994

Since ```self._dispatch``` has ```dict.__repr__: self._pprint_dict``` the ```elif``` block is not needed.
@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@Palakjha

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@aeros aeros left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Palakjha and welcome!

This PR will require a signed CLA prior to merging, since it involves a code change (even if it's just removing 6 lines). After 24-48 hours of signing the CLA, you can check the status via the CLA assistant. If it detects that your CLA has been signed, the label will update from CLA not signed to CLA signed.

Let me know if you have any questions. :)

@aeros aeros added the type-feature A feature request or enhancement label Mar 18, 2020
@csabella
csabella requested a review from serhiy-storchaka May 28, 2020 00:13
@iritkatriel

Copy link
Copy Markdown
Member

This change makes a difference in semantics (perhaps a good one) in this case:

import pprint

class MyDict(dict):
    def __repr__(self):
        return 'I do my own thing'*50


if __name__ == '__main__':
    d=MyDict()
    for i in range(50):
        d['a%s'%i] = i

    pprint.pprint(d)

Before the change MyDict.repr is ignored and the dict contents are printed. After the change it prints "I do my own thing" 50 times.

@iritkatriel iritkatriel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this causes a change in behavior it needs to be submitted with an appropriate title/commit message, test and documentation update.

@ericvsmith

Copy link
Copy Markdown
Member

Since the original author has vanished, I'm going to close this and note that I did so on the bpo.

@ericvsmith ericvsmith closed this Aug 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants