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


Groups > comp.lang.python > #85534

Re: function inclusion problem

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'received:209.85.223': 0.03; 'importing': 0.05; 'sys': 0.07; 'imported': 0.09; 'override': 0.09; 'separately': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'files:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'similarly,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'thu,': 0.19; 'feb': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'module,': 0.24; 'subject:problem': 0.24; 'math': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'ones.': 0.31; 'run': 0.32; 'programmers': 0.33; 'could': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doubt': 0.36; 'received:209': 0.37; 'form,': 0.38; 'files': 0.38; '12,': 0.39; 'sure': 0.39; 'even': 0.60; 'dave': 0.60; 'sum': 0.64; 'more': 0.64; 'total': 0.65; 'here': 0.66; 'determine': 0.67; 'other.': 0.75; '2015': 0.84; 'conflicts': 0.84; "it'd": 0.84; 'obvious.': 0.84; 'angel': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=RkT99+QJWMltmx4Jpjw2Ldo6Ycow56EitA5XVbzDxxE=; b=D9um+wM0ogqSP20y1MBp0cEcOhLcC3PR8n5zVJeNM0xmi2kGXU9KNogiJfZUiMz7fO J4QQygsTz0XsD0HwpwwXe97iK6hAl33OeDLLFFTvn8NcMx+o1FkBmfP+Gug5s7Y0JYyk pCvYfIF39xje/nc+RpCs19FIRITnYpqOTEjup/fG99AfKV34+6eQsrEGP0ODeAaPh2Re Eg3hKDqGUWx8FNhWBeLn0VdljGpsaPctDAVwhoEXBE4Tywcdb8LnrbC54Niw6AlTvvOe lNrzynUe2p0lINIaANWiW5H3/h+y5PpTfHL+pzLWJR8o1PU5AncKv31jmtuoNh+bjNG6 /ogw==
MIME-Version 1.0
X-Received by 10.50.171.201 with SMTP id aw9mr4413853igc.2.1423669037012; Wed, 11 Feb 2015 07:37:17 -0800 (PST)
In-Reply-To <54DB701A.9060203@davea.name>
References <d7871507-2677-4fef-9462-d429217e7ad3@googlegroups.com> <lac@openend.se> <201502110006.t1B060VZ021974@fido.openend.se> <201502110016.t1B0GVah024279@fido.openend.se> <CADBUHVZJ1RP4kwXiagO5dJnWKuYoOy_L=sob6zP1-wo+T4BzDQ@mail.gmail.com> <54DB701A.9060203@davea.name>
Date Thu, 12 Feb 2015 02:37:16 +1100
Subject Re: function inclusion problem
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18658.1423669040.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1423669040 news.xs4all.nl 2846 [2001:888:2000:d::a6]:60851
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:85534

Show key headers only | View raw


On Thu, Feb 12, 2015 at 2:07 AM, Dave Angel <d@davea.name> wrote:
> Similarly, if you import from more than one module, and use the import*
> form, they could conflict with each other.  And the order of importing will
> (usually) determine which names override which ones.

Never mind about conflicts and order of importing... just try figuring
out code like this:

from os import *
from sys import *
from math import *

# Calculate the total size of all files in a directory
tot = 0
for path, dirs, files in walk(argv[1]):
    # We don't need to sum the directories separately
    for f in files:
        # getsizeof() returns a value in bytes
        tot += getsizeof(f)/1024.0/1024.0

print("Total directory size:", floor(tot), "MB")

Now, I'm sure some of the experienced Python programmers here can see
exactly what's wrong. But can everyone? I doubt it. Even if you run
it, I doubt you'd get any better clue. But if you could see which
module everything was imported from, it'd be pretty obvious.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

function inclusion problem vlyamtsev@gmail.com - 2015-02-10 15:38 -0800
  Re: function inclusion problem sohcahtoa82@gmail.com - 2015-02-10 15:55 -0800
  Re: function inclusion problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-11 10:57 +1100
  Re: function inclusion problem Michael Torrie <torriem@gmail.com> - 2015-02-10 17:00 -0700
  Re: function inclusion problem sohcahtoa82@gmail.com - 2015-02-10 16:02 -0800
  Re: function inclusion problem Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-10 17:02 -0700
  Re: function inclusion problem Laura Creighton <lac@openend.se> - 2015-02-11 01:06 +0100
  Re: function inclusion problem Laura Creighton <lac@openend.se> - 2015-02-11 01:16 +0100
  Re: function inclusion problem Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-02-10 20:52 -0500
  Re: function inclusion problem Victor L <vlyamtsev@gmail.com> - 2015-02-11 08:27 -0500
  Re: function inclusion problem Dave Angel <d@davea.name> - 2015-02-11 10:07 -0500
  Re: function inclusion problem Tim Chase <python.list@tim.thechases.com> - 2015-02-11 09:22 -0600
  Re: function inclusion problem Chris Angelico <rosuav@gmail.com> - 2015-02-12 02:37 +1100
  Re: function inclusion problem blue <catalinfest@gmail.com> - 2015-02-27 12:11 -0800

csiph-web