Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78034 > unrolled thread

Re: program to generate data helpful in finding duplicate large files

Started byChris Angelico <rosuav@gmail.com>
First post2014-09-19 04:50 +1000
Last post2014-09-19 11:08 +1200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: program to generate data helpful in finding duplicate large files Chris Angelico <rosuav@gmail.com> - 2014-09-19 04:50 +1000
    Re: program to generate data helpful in finding duplicate large files Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-09-19 11:08 +1200

#78034 — Re: program to generate data helpful in finding duplicate large files

FromChris Angelico <rosuav@gmail.com>
Date2014-09-19 04:50 +1000
SubjectRe: program to generate data helpful in finding duplicate large files
Message-ID<mailman.14117.1411066256.18130.python-list@python.org>
On Fri, Sep 19, 2014 at 4:45 AM, Chris Kaynor <ckaynor@zindagigames.com> wrote:
>> from stat import *
>
>
> Generally, from import * imports are discouraged as they tend to populate
> your namespace and have issues with accidentally overriding imported
> functions/variables. Generally, its more Pythonic to use the other imports
> (or import as) and reference with the namespace, as you are doing everywhere
> else. The main case where from import * is recommended is API imports (for
> example, importing the API of one module into another, such as for
> inter-platform, inter-version, or accelerator support).
>

I was going to say the same thing, except that this module
specifically is documented as recommending that. I still don't like
"import *", but either this is a special case, or the docs need to be
changed.

ChrisA

[toc] | [next] | [standalone]


#78051

FromGregory Ewing <greg.ewing@canterbury.ac.nz>
Date2014-09-19 11:08 +1200
Message-ID<c8170bF2nokU1@mid.individual.net>
In reply to#78034
Chris Angelico wrote:
> On Fri, Sep 19, 2014 at 4:45 AM, Chris Kaynor <ckaynor@zindagigames.com> wrote:
> 
>>>from stat import *
> 
> I was going to say the same thing, except that this module
> specifically is documented as recommending that. I still don't like
> "import *", but either this is a special case, or the docs need to be
> changed.

I think it's something of a special case. The main issue with
import * is that it makes it hard for someone reading the code
to tell where names are coming from.

However, all the names in the stat module are prefixed with
S_ or ST_ and are well-known stat-related names from the unix
C library, so there is less room for confusion in this case.

-- 
Greg

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web