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

fileinput openfile patch, bz2fileinput #42109

Closed
sib4 mannequin opened this issue Jun 22, 2005 · 4 comments
Closed

fileinput openfile patch, bz2fileinput #42109

sib4 mannequin opened this issue Jun 22, 2005 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@sib4
Copy link
Mannequin

sib4 mannequin commented Jun 22, 2005

BPO 1225466
Nosy @birkenfeld
Files
  • bz2fileinput.patch: bz2fileinput patch
  • 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 = <Date 2005-09-01.14:01:05.000>
    created_at = <Date 2005-06-22.11:50:15.000>
    labels = ['library']
    title = 'fileinput openfile patch, bz2fileinput'
    updated_at = <Date 2005-09-01.14:01:05.000>
    user = 'https://bugs.python.org/sib4'

    bugs.python.org fields:

    activity = <Date 2005-09-01.14:01:05.000>
    actor = 'sib4'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2005-06-22.11:50:15.000>
    creator = 'sib4'
    dependencies = []
    files = ['6700']
    hgrepos = []
    issue_num = 1225466
    keywords = ['patch']
    message_count = 4.0
    messages = ['48495', '48496', '48497', '48498']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'hoffman', 'sib4']
    pr_nums = []
    priority = 'normal'
    resolution = 'rejected'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1225466'
    versions = ['Python 2.3']

    @sib4
    Copy link
    Mannequin Author

    sib4 mannequin commented Jun 22, 2005

    Please consider the enclosed patch to fileinput.py,
    which implements an openfile method of FileInput.
    Included is a use case bz2fileinput.py.

    @sib4 sib4 mannequin closed this as completed Jun 22, 2005
    @sib4 sib4 mannequin added the stdlib Python modules in the Lib dir label Jun 22, 2005
    @sib4 sib4 mannequin closed this as completed Jun 22, 2005
    @sib4 sib4 mannequin added the stdlib Python modules in the Lib dir label Jun 22, 2005
    @hoffman
    Copy link
    Mannequin

    hoffman mannequin commented Jun 30, 2005

    Logged In: YES
    user_id=987664

    Hmmm. This could be useful. Pythonistas could also supply
    openfile for, say, URLs as well. I'm kind of lukewarm on it
    for some reason--I think that you'd be better off
    decompressing the data somewhere else. I also did some
    benchmarking the other day and found that fileinput is
    really, really slow.

    I don't understand the change from Fileinput to _Fileinput.
    You're going to need to fix the inplace stuff in
    Fileinput.readline().

    This needs documentation, and a more detailed description.

    Please provide a patch against the latest CVS instead of
    Python 2.3.

    @birkenfeld
    Copy link
    Member

    Logged In: YES
    user_id=1188172

    In addition to hoffmanm's question about the renaming of
    FileInput, two issues:

    • An additional module, especially with only a few lines in
      it, is not going to be accepted into the stdlib. This is
      better done in your own code, where you know what types of
      files you will encounter.
      See patch bpo-1215184, which implements a similar openhook for
      fileinput.
    • Only bz2 is too selective. You would have to have modules
      "gzfileinput", "urlfileinput", etc. Too much name crowding.

    For these reasons, rejecting this patch.

    @sib4
    Copy link
    Mannequin Author

    sib4 mannequin commented Sep 1, 2005

    Logged In: YES
    user_id=252223

    Sorry for not responding in time to those questions.

    My proposal was meant to provide the openfile method, and
    provide the user with a way to override it and still use the
    static infrastructure if the fileinput module, as
    demonstrated by bz2fileinput.py.

    Instead of using the hook "_FileInput" to provide a
    replacement class to the module, it may be better to replace
    FileInput.openfile() in derived modules, but I thought that
    may be even more of a hack.

    If you think this is worth following up, please advise of
    the best way to achieve this goal.

    Thanks
    Stephan

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant