GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-40066: [Enum] update str() and format() output by ethanfurman · Pull Request #30582 · python/cpython

Conversation

@ethanfurman

@ethanfurman ethanfurman commented Jan 13, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

https://bugs.python.org/issue40066

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jan 13, 2022
@bedevere-bot bedevere-bot added the awaiting core review label Jan 13, 2022
@AlexWaygood AlexWaygood closed this Jan 13, 2022
@AlexWaygood AlexWaygood reopened this Jan 13, 2022
@AlexWaygood

AlexWaygood commented Jan 13, 2022

Copy link
Copy Markdown
Member

Omg, did not mean to close that at all — sorry!!

ethanfurman reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sobolevn
sobolevn reviewed Jan 14, 2022
View reviewed changes

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for your work! Enums' text representation looks way better now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/enum.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/enum.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/enum.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/enum.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/enum.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/enum.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/enum.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/enum.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/enum.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

ethanfurman added 16 commits January 14, 2022 14:25
@ethanfurman
convert tests to PEP-663
88b2a25
@ethanfurman
wip
22e8e2f
@ethanfurman
wip
881a694
@ethanfurman
wip
6cdaa91
@ethanfurman
wip
3a17995
@ethanfurman
wip
6ff602a
@ethanfurman
wip
65a0e31
@ethanfurman
wip
06f0dc8
@ethanfurman
update __doc__
13c4b92
@ethanfurman
fix role
7072a3f
@ethanfurman
support different display bases for unnamed flag values
56647c5
@ethanfurman
undo PEP 663 library changes
ab4598c
@ethanfurman
adjust internal whitespace in error messages
7b6b17b
@ethanfurman
test new doc strings
bb0c67e
@ethanfurman
fix "cannoct extend" error; remove dead code
837c211
@ethanfurman
minor fixes
d36aeda
@ethanfurman
ethanfurman force-pushed the 40066-enum_output branch from 4da9925 to d36aeda Compare January 14, 2022 22:37
ethanfurman added 7 commits January 14, 2022 14:57
@ethanfurman
fix ssl docs
cff9b90
@ethanfurman
use standard IntEnum and IntFlag
2036918
@ethanfurman
update test_unicode
94e1c64
@ethanfurman
reset PlistFormat to pre-PEP663
7f99e84
@ethanfurman
fix docs
f83f59d
@ethanfurman
doc updates
6d54605
@ethanfurman
update docs
515698e
ethanfurman added 3 commits January 15, 2022 19:10
@ethanfurman
skip failing doctest because doctest is dumb
2831f99
@ethanfurman
fix doctest test
03c1cfc
@ethanfurman
another try
de6ffde
@ethanfurman
ethanfurman merged commit acf7403 into python:main Jan 16, 2022
@bedevere-bot bedevere-bot removed the awaiting core review label Jan 16, 2022
@AlexWaygood

AlexWaygood commented Jan 16, 2022

Copy link
Copy Markdown
Member

This change appears to be causing CI to fail on docs for unrelated PRs ☹️ https://github.com/python/cpython/runs/4831439882?check_suite_focus=true

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner added a commit that referenced this pull request Jan 17, 2022
@vstinner
Revert "bpo-40066: [Enum] update str() and format() output (GH-30582)"
7d7be71
This reverts commit acf7403.
@vstinner vstinner mentioned this pull request Jan 17, 2022
Revert "bpo-40066: [Enum] update str() and format() output" #30632
Merged
vstinner added a commit that referenced this pull request Jan 17, 2022
@vstinner
Revert "bpo-40066: [Enum] update str() and format() output (GH-30582)" (
42a64c0
GH-30632)

This reverts commit acf7403.
kumaraditya303 added a commit to kumaraditya303/cpython that referenced this pull request Jan 17, 2022
@kumaraditya303
Revert "Revert "bpo-40066: [Enum] update str() and format() output (p…
39ecb6a
…ythonGH-30582)" (pythonGH-30632)"

This reverts commit 42a64c0.
This was referenced May 23, 2022
enum.global_enum: cls_name undefined in global_str #93100
Closed
enum: Member names accidentally removed from "invalid enum member name(s)" message #93118
Closed
@AdamWill

AdamWill commented Jul 11, 2022

Copy link
Copy Markdown
Contributor

I'm curious: why does this define a __init__ for Enum which does nothing at all (just pass)?

It causes pylint to start throwing warnings about subclasses of Enum which have their own __init__ not calling super's __init__, which Python's own docs and examples don't say they should, and which of course would be pointless since it does nothing. I'm sending a PR for pylint to not emit this warning for subclasses of Enum, but I don't understand why the do-nothing __init__ was added at all.

AlexWaygood, DanielNoord, and Pierre-Sassoulas reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AdamWill AdamWill mentioned this pull request Jul 11, 2022
Fix tests for Python 3.11 pylint-dev/pylint#7167
Merged
@DanielNoord DanielNoord mentioned this pull request Jul 14, 2022
Don't emit super-init-not-called for Enum subclasses pylint-dev/pylint#7181
Closed
@mdboom mdboom mentioned this pull request Oct 13, 2022
Enum.__str__ change could be improved in What's New #98250
Closed
@ethanfurman
ethanfurman deleted the 40066-enum_output branch November 23, 2022 23:50
gryznar
gryznar reviewed Nov 25, 2022
View reviewed changes
Comment thread Lib/inspect.py
@@ -2567,30 +2567,28 @@ class _empty:


class _ParameterKind(enum.IntEnum):

@gryznar gryznar Nov 25, 2022

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Is that inheritting correct where the values are changed to str?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ethanfurman ethanfurman Nov 25, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@gryznar Good question: only because the __new__ uses integers as the values, and the "value" on the assignment line is saved in the description attribute. Without the custom __new__ the enum creation would have failed, since strings are not integers.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gryznar
gryznar reviewed Nov 25, 2022
View reviewed changes
Comment thread Lib/enum.py
if invalid_names:
raise ValueError('Invalid enum member name: {0}'.format(
','.join(invalid_names)))
raise ValueError('invalid enum member name(s) '.format(

@gryznar gryznar Nov 25, 2022

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Is removing "{0}" proper?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ethanfurman ethanfurman Nov 25, 2022

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@gryznar Only because it was changed to %s later.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Dec 18, 2024
It seems that enum.Enum.__init__ serves no purpose #128080
Closed
gh-128080: remove unnecessary __init__ method from Enum #128081
Merged
@hugovk hugovk mentioned this pull request Apr 7, 2025
enum: remove unused function #132044
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sobolevn sobolevn sobolevn left review comments
+1 more reviewer
@gryznar gryznar gryznar left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@ethanfurman @AlexWaygood @AdamWill @sobolevn @gryznar @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.