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

Difference between open and codecs.open #61639

Open
giampaolo opened this issue Mar 16, 2013 · 2 comments
Open

Difference between open and codecs.open #61639

giampaolo opened this issue Mar 16, 2013 · 2 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir

Comments

@giampaolo
Copy link
Contributor

BPO 17437
Nosy @vstinner, @giampaolo, @ezio-melotti

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2013-03-16.10:58:59.820>
labels = ['3.8', '3.9', '3.10', 'docs']
title = 'Difference between open and codecs.open'
updated_at = <Date 2020-11-15.18:58:13.731>
user = 'https://github.com/giampaolo'

bugs.python.org fields:

activity = <Date 2020-11-15.18:58:13.731>
actor = 'iritkatriel'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2013-03-16.10:58:59.820>
creator = 'giampaolo.rodola'
dependencies = []
files = []
hgrepos = []
issue_num = 17437
keywords = []
message_count = 2.0
messages = ['184303', '184305']
nosy_count = 4.0
nosy_names = ['vstinner', 'giampaolo.rodola', 'ezio.melotti', 'docs@python']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue17437'
versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

@giampaolo
Copy link
Contributor Author

In Python 2 the distinction between open() and codes.open() was clear because 'encoding' and 'errors' args were provided by codecs.open only.
This is no longer the case in Python 3 since both args are provided also by open().

I'm probably missing something but regardless I think codecs.open doc [1] should be more clear as to when and why (say) codecs.open(file, encoding='utf8', errors='ignore') should be preferred over open(file, encoding='utf8', errors='ignore').

[1] http://docs.python.org/3/library/codecs.html#codecs.open

@giampaolo giampaolo added the docs Documentation in the Doc dir label Mar 16, 2013
@vstinner
Copy link
Member

See also the PEP-400. I proposed (in the alternative) to make codecs.open() somehow an alias to open() (and add codecs.open_stream() for "backward compatibility").

@iritkatriel iritkatriel added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Nov 15, 2020
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir
Projects
Development

No branches or pull requests

3 participants