Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85534
| References | (1 earlier) <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 | 2015-02-12 02:37 +1100 |
| Subject | Re: function inclusion problem |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18658.1423669040.18130.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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