Path: csiph.com!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'assign': 0.07; 'alias': 0.09; 'collier': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'callable': 0.16; 'os.getcwd()': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'syntaxerror:': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User- Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'am,': 0.29; "skip:' 10": 0.31; '"",': 0.31; 'file': 0.32; 'running': 0.33; '(most': 0.33; 'could': 0.34; "can't": 0.35; 'johnson': 0.35; 'but': 0.35; 'work?': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'how': 0.40; 'making': 0.63 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: Critic my module Date: Sat, 27 Jul 2013 09:35:50 -0400 References: <51f334eb$0$29971$c3e8da3$5496439d@news.astraweb.com> <51F3C8FA.9040801@Gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 174.32.174.34 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 In-Reply-To: <51F3C8FA.9040801@Gmail.com> 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374932171 news.xs4all.nl 15910 [2001:888:2000:d::a6]:38109 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51355 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 -- DaveA