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

PEP 8 function names: asdict -> as_dict, astuple -> as_tuple #110

Closed
ericvsmith opened this Issue Dec 3, 2017 · 8 comments

Comments

Projects
None yet
6 participants
@ericvsmith
Owner

ericvsmith commented Dec 3, 2017

No description provided.

@ilevkivskyi

This comment has been minimized.

Show comment
Hide comment
@ilevkivskyi

ilevkivskyi Dec 3, 2017

Contributor

I don't think this improves readability. I would even say that using underscores in such short names looks a bit weird.

Contributor

ilevkivskyi commented Dec 3, 2017

I don't think this improves readability. I would even say that using underscores in such short names looks a bit weird.

@warsaw

This comment has been minimized.

Show comment
Hide comment
@warsaw

warsaw Dec 3, 2017

Actually, I agree with @ericvsmith that underscores improve readability, so I'm +1 on as_dict and as_tuple. There are a lot of places in the stdlib that use wordswithoutunderscores (e.g. isinstance) so consistency is more important, but for new APIs, we should use underscore names.

warsaw commented Dec 3, 2017

Actually, I agree with @ericvsmith that underscores improve readability, so I'm +1 on as_dict and as_tuple. There are a lot of places in the stdlib that use wordswithoutunderscores (e.g. isinstance) so consistency is more important, but for new APIs, we should use underscore names.

@gvanrossum

This comment has been minimized.

Show comment
Hide comment
@gvanrossum

gvanrossum Dec 4, 2017

gvanrossum commented Dec 4, 2017

@hynek

This comment has been minimized.

Show comment
Hide comment
@hynek

hynek Dec 4, 2017

FWIW, I’m a huge fan of underscores and their lack bothers me in asdict. But as Guido points out, we have a precedent and I found it unfortunate/confusing to build an API that has the same name but a different spelling.

hynek commented Dec 4, 2017

FWIW, I’m a huge fan of underscores and their lack bothers me in asdict. But as Guido points out, we have a precedent and I found it unfortunate/confusing to build an API that has the same name but a different spelling.

@ericvsmith

This comment has been minimized.

Show comment
Hide comment
@ericvsmith

ericvsmith Dec 4, 2017

Owner

Okay, let's leave this as-is, without the underscore. I'll add a note to the PEP that we're choosing consistency with existing APIs as the reason.

Owner

ericvsmith commented Dec 4, 2017

Okay, let's leave this as-is, without the underscore. I'll add a note to the PEP that we're choosing consistency with existing APIs as the reason.

@ericvsmith

This comment has been minimized.

Show comment
Hide comment
@ericvsmith

ericvsmith Dec 4, 2017

Owner

PEP updated.

Owner

ericvsmith commented Dec 4, 2017

PEP updated.

@ericvsmith ericvsmith closed this Dec 4, 2017

@alexmojaki

This comment has been minimized.

Show comment
Hide comment
@alexmojaki

alexmojaki Jun 7, 2018

Would it be bad to have an alias as_dict = asdict? I see this is something that is not generally done in the standard library but I don't know why.

This is not meant to imply that I am bothered by the name asdict, I'm just wondering why not both.

alexmojaki commented Jun 7, 2018

Would it be bad to have an alias as_dict = asdict? I see this is something that is not generally done in the standard library but I don't know why.

This is not meant to imply that I am bothered by the name asdict, I'm just wondering why not both.

@ericvsmith

This comment has been minimized.

Show comment
Hide comment
@ericvsmith

ericvsmith Jun 7, 2018

Owner

We wouldn't want to have two names for the same thing. It adds confusion.

Owner

ericvsmith commented Jun 7, 2018

We wouldn't want to have two names for the same thing. It adds confusion.

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