Skip to content

gh-74166: make all_errors keyword-only - #91704

Merged
iritkatriel merged 1 commit into
python:mainfrom
iritkatriel:kw-only
Apr 19, 2022
Merged

iritkatriel merged 1 commit into
python:mainfrom
iritkatriel:kw-only

Conversation

@iritkatriel

Copy link
Copy Markdown
Member

No description provided.

Comment thread Lib/socket.py

def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
source_address=None, all_errors=False):
source_address=None, *, all_errors=False):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is it weird that all_errors is kw-only and the others are not?

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.

Nope. It's called "legacy" :-)

@vstinner vstinner 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.

LGTM.

Comment thread Lib/socket.py

def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
source_address=None, all_errors=False):
source_address=None, *, all_errors=False):

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.

Nope. It's called "legacy" :-)

@vstinner

Copy link
Copy Markdown
Member

Thanks.

Once I wanted to convert most open() parameter to keyword-only. I never recall what are positional parameter after the first two obvious arguments. But my idea got quickly rejected. "The ship has sailed", it's too late to convert positional-or-keyword parameter to keyword-only, at least without a slow deprecation process. But for new parameter, we have a great freedom to decide how to declare them! Keyword only, positional only, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants