Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51355
| 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 | <python-python-list@m.gmane.org> |
| 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 <davea@davea.name> |
| Subject | Re: Critic my module |
| Date | Sat, 27 Jul 2013 09:35:50 -0400 |
| References | <mailman.5092.1374758683.3114.python-list@python.org> <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 <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5169.1374932171.3114.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
On 07/27/2013 09:19 AM, Devyn Collier Johnson wrote:
>
<SNIP>
> 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 "<stdin>", line 1, in <module>
> TypeError: 'str' object is not callable
> >>> pwd
> '/home/collier'
> >>> pwd() = os.getcwd()
> File "<stdin>", 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-25 09:24 -0400
Re: Critic my module Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-07-25 16:09 +0200
Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-26 06:59 -0400
Re: Critic my module Alister <alister.ware@ntlworld.com> - 2013-07-26 15:08 +0000
Re: Critic my module Joshua Landau <joshua@landau.ws> - 2013-07-26 18:24 +0100
Re: Critic my module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-27 02:48 +0000
Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-27 08:56 -0400
Re: Critic my module Alister <alister.ware@ntlworld.com> - 2013-07-27 16:32 +0000
Re: Critic my module Dave Angel <davea@davea.name> - 2013-07-27 12:58 -0400
Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-27 09:19 -0400
Re: Critic my module Dave Angel <davea@davea.name> - 2013-07-27 09:35 -0400
Re: Critic my module Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-07-27 15:36 +0200
Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-27 09:44 -0400
Re: Critic my module Chris Angelico <rosuav@gmail.com> - 2013-07-27 14:37 +0100
Re: Critic my module Dave Angel <davea@davea.name> - 2013-07-27 10:33 -0400
Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-27 10:53 -0400
Re: Critic my module Chris Angelico <rosuav@gmail.com> - 2013-07-27 16:15 +0100
csiph-web