Path: csiph.com!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.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.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'assign': 0.07; 'alias': 0.09; 'collier': 0.09; 'subject:module': 0.09; 'callable': 0.16; 'os.getcwd()': 0.16; 'syntaxerror:': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'header :In-Reply-To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'am,': 0.29; 'received:10.0.0': 0.31; "skip:' 10": 0.31; '"",': 0.31; 'file': 0.32; 'thanks!': 0.32; 'running': 0.33; '(most': 0.33; 'could': 0.34; "can't": 0.35; 'johnson': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'received:10.0': 0.36; 'received:10': 0.37; 'work?': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; 'dave': 0.60; 'making': 0.63; 'angel': 0.91; 'works!': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=4F7m/480AjZOCyhQznKGsQpDZJTVqyCRi3XkgxiKSEA=; b=Zced4TxdDu6FY4NDKxk8uhCymphdrCziu5MitmVFWrlzBH5Huxmej3I3Yg/4QrYj6I yjvfbebcP1k7TwwUCzQraszTMqCri0Tk63GgWQgUeBcxtVrme8uD8sO1fO8AP9tC9hUw EqFDwly8CKErM61WZw4EYwjh66Jc9mSd+yyq5UzxIPPkt6iWa4Be1p1jkqR5d17phLer mL4HzkMwX2eGWXyM+4a07QvlQJV0ktOdnbNCD8bGDmGgTbHOggV9l553M6DvsTsC1zeP q4ayg//fEIejGFF3U//mf2f0a1YzYPRBNZe5sXHpr0IM6fiWJkuUg8XvEbZdYdHuNRA3 mtiQ== X-Received: by 10.60.96.170 with SMTP id dt10mr51942161oeb.81.1374932672447; Sat, 27 Jul 2013 06:44:32 -0700 (PDT) Date: Sat, 27 Jul 2013 09:44:24 -0400 From: Devyn Collier Johnson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: Python Mailing List Subject: Re: Critic my module References: <51f334eb$0$29971$c3e8da3$5496439d@news.astraweb.com> <51F3C8FA.9040801@Gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374932681 news.xs4all.nl 15996 [2001:888:2000:d::a6]:45905 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51358 On 07/27/2013 09:35 AM, Dave Angel wrote: > On 07/27/2013 09:19 AM, Devyn Collier Johnson wrote: >> > > > >> About the aliases, I have tried setting pwd() as an alias for >> "os.getcwd()", but I cannot type "pwd()" and get the desired output. >> Instead, I must type "pwd". I tested this in Guake running Python3.3. >> >> >>> os.getcwd() >> '/home/collier' >> >>> pwd = os.getcwd() >> >>> pwd() >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: 'str' object is not callable >> >>> pwd >> '/home/collier' >> >>> pwd() = os.getcwd() >> File "", line 1 >> SyntaxError: can't assign to function call >> >> >> How could I make pwd() work? > > Don't call getcwd() when making the alias. You want it to be called > when USING the alias. > > pwd = os.getcwd #creates the alias > > pwd() #runs the alias > > > Thanks! It works! >>> pwd = os.getcwd >>> pwd() '/home/collier' Mahalo, Dave! DCJ