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


Groups > comp.lang.python > #70986 > unrolled thread

Re: Pass variable by reference

Started byMichael Torrie <torriem@gmail.com>
First post2014-05-06 14:57 -0600
Last post2014-05-06 14:57 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#70986 — Re: Pass variable by reference

FromMichael Torrie <torriem@gmail.com>
Date2014-05-06 14:57 -0600
SubjectRe: Pass variable by reference
Message-ID<mailman.9711.1399409846.18130.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web