Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70986
| Date | 2014-05-06 14:57 -0600 |
|---|---|
| From | Michael Torrie <torriem@gmail.com> |
| Subject | Re: Pass variable by reference |
| References | <235C4BFA-9770-481A-9FCF-21C3F036769C@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9711.1399409846.18130.python-list@python.org> (permalink) |
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
Re: Pass variable by reference Michael Torrie <torriem@gmail.com> - 2014-05-06 14:57 -0600
csiph-web