Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70986

Re: Pass variable by reference

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'python.': 0.02; 'string': 0.09; 'function,': 0.09; 'suggest': 0.14; '"in': 0.16; 'dictionary,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'goal,': 0.16; 'mutable': 0.16; 'parameter.': 0.16; 'subject:variable': 0.16; 'wrote:': 0.18; 'module': 0.19; 'header :User-Agent:1': 0.23; 'string,': 0.24; 'pass': 0.26; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'appreciated.': 0.29; 'explained': 0.31; 'class': 0.32; 'another': 0.32; 'raw': 0.33; 'could': 0.34; 'but': 0.35; 'list': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'around.': 0.60; 'new': 0.61; 'more': 0.64; 'yes': 0.68; 'as:': 0.81; 'actually,': 0.84; 'skip:/ 30': 0.84
X-Virus-Scanned amavisd-new at torriefamily.org
Date Tue, 06 May 2014 14:57:12 -0600
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
MIME-Version 1.0
To python-list@python.org
Subject Re: Pass variable by reference
References <235C4BFA-9770-481A-9FCF-21C3F036769C@gmail.com>
In-Reply-To <235C4BFA-9770-481A-9FCF-21C3F036769C@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9711.1399409846.18130.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1399409846 news.xs4all.nl 2966 [2001:888:2000:d::a6]:56297
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70986

Show key headers only | View raw


On 05/05/2014 06:39 PM, Satish Muthali wrote:
> I want to nuke /var/lib/postgresql/9.3.4/main/data , however
> programatically I want it to be as:  /var/lib/postgresql/<value of
> pgversion>/main/data
> 
> Any help is appreciated.

Not sure really.  But if you want to pass a some data around that can be
manipulated "in place" as it were, say in a function, then yes it must
be either a mutable object like a list or a dictionary, or you can wrap
up your data in a class and manipulate it via an instance of that class
that you pass around.  You can do the same thing in a module too,
actually, which is a form of singleton.

Another solution is just to have a function return a new cooked string,
based on a raw string passed in as a parameter.

Perhaps if you explained more clearly your end goal, people could
suggest ideas in accomplishing it in a way that works well in Python.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Pass variable by reference Michael Torrie <torriem@gmail.com> - 2014-05-06 14:57 -0600

csiph-web