Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion My first ever Python program, comments welcome
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Steven D'Aprano  
View profile  
 More options Jul 21 2012, 8:56 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>
Date: 22 Jul 2012 00:56:55 GMT
Local: Sat, Jul 21 2012 8:56 pm
Subject: Re: My first ever Python program, comments welcome

On Sat, 21 Jul 2012 16:10:51 -0400, Dave Angel wrote:
>> with fileinput.input(files=(filename)) as f:

> fileinput is much more general than you want for processing a single
> file.  That may be deliberate, if you're picturing somebody using
> wildcards on their input.  But if so, you should probably use a
> different name, something that indicates plural.

Also, fileinput is more a convenience module than a serious production
quality tool. It works, it does the job, but it can be slow. From the
source:

    Performance: this module is unfortunately one of the slower ways of
    processing large numbers of input lines.

--
Steven


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.