Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.040 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'variant': 0.09; 'cc:addr :python-list': 0.11; 'random': 0.14; '"from': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'program?': 0.16; 'wrote:': 0.18; 'command': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'sep': 0.31; 'url:python': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; '14,': 0.36; 'url:org': 0.36; 'two': 0.37; 'does': 0.39; 'url:3': 0.61; "'from'": 0.84; 'random,': 0.84; '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=6UOeUSjc/0oMmyZykXONmG6bkEflvHuQRkqlEHmSUrM=; b=Q0dIGOUIV6Xoka3dX+XaredAVrpV4gR35CDDnjVu2f7hv/atyhZv5vXx0DxTCckjWd 5nDI7PDQEF8SCMQuEUNfaEoHVT+lTn6coNukcwuHupCSorsrUS8IyzUdY3HfEexWrU+c wPolwgxnNSw5DHaLQaMzX4NcFRyr3JUTiFEoz1225M9ZQg15Hf+GpypuklxfS/BzkAhF Er44nEmU1WzO6MXRRuChZsYP6DcQ3ZamxNeK67LkefzOw4IoEJCpwZb45f56exoArNu6 rhFGGJZFQIfdF+styXGUhY5gfK2wtrM8horIThQCRPKMYDDSe8xLHET5MBKskWag5Djw TGCg== MIME-Version: 1.0 X-Received: by 10.50.176.202 with SMTP id ck10mr12770014igc.2.1410654533505; Sat, 13 Sep 2014 17:28:53 -0700 (PDT) In-Reply-To: References: Date: Sun, 14 Sep 2014 10:28:53 +1000 Subject: Re: Shuffle From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410654536 news.xs4all.nl 2885 [2001:888:2000:d::a6]:45097 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77854 On Sun, Sep 14, 2014 at 9:47 AM, Seymore4Head wrote: > Two questions > If you import random, do you need to "from random import shuffle"? > > Why does shuffle work from the command line and not when I add it to > this program? > > import random > import shuffle To understand this, you need to understand what the 'from' import does: https://docs.python.org/3/tutorial/modules.html#more-on-modules It's not the same as "import shuffle", but is a variant of "import random". ChrisA