Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.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.036 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'python.': 0.02; 'example:': 0.03; 'postgresql': 0.07; 'subject:variable': 0.16; 'variable': 0.18; 'trying': 0.19; '(where': 0.19; 'print': 0.22; 'question': 0.24; 'pass': 0.26; 'appreciated.': 0.29; 'extract': 0.31; 'skip:- 30': 0.32; 'running': 0.33; 'received:google.com': 0.35; 'version': 0.36; 'var': 0.36; 'thanks': 0.36; 'example,': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'header:Message-Id:1': 0.63; 'charset:windows-1252': 0.65; 'as:': 0.81; 'burning': 0.84; 'skip:/ 30': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:subject:message-id:date:to:mime-version; bh=79ec0xv+9d2bQaMeDuzOUSNM73m2LBRshRPGngxtSPM=; b=eue1UH/UXvn/Lu/8AmCTvELOIuBq6POfy2xHTxBMg1yhkF/mw7QS9v6QxhrrPO/g3/ X0amndphmy90CJXU7zMnLolMGqrHYa+ahEfgauIGNdU0QrMg+dhZJGQsH3HPj1FhslXm Bm5UgR4h1dSpqtnuU5T9a+0lvrV2XDD1bmUcDbqu9pYGuTol2UDttktHbauwRxB3sgUo oe+bcXpiKOR4Tfuj4XwnIUQUK/L/XRxwCSIxnE40lLgenl9UFdfjsmqeciSwarDUdww7 ihqdK/aYDYxXnmwnv//IdrcOjKEqxj4Bo7xBgOwiFReGQZ1xgiFW+x0b2xQt24zWCdQA Wy2Q== X-Received: by 10.66.250.161 with SMTP id zd1mr238873pac.136.1399336787965; Mon, 05 May 2014 17:39:47 -0700 (PDT) From: Satish Muthali Content-Type: multipart/alternative; boundary="Apple-Mail=_48C16828-C097-4FD6-9576-401F77D302E6" Subject: Pass variable by reference Date: Mon, 5 May 2014 17:39:44 -0700 To: python-list@python.org Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) X-Mailer: Apple Mail (2.1874) X-Mailman-Approved-At: Tue, 06 May 2014 05:53:14 +0200 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: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399348396 news.xs4all.nl 2875 [2001:888:2000:d::a6]:50782 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70941 --Apple-Mail=_48C16828-C097-4FD6-9576-401F77D302E6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Hello experts, I have a burning question on how to pass variable by reference in = Python. I understand that the data type has to be mutable. For example, here=92s the issue I am running in to: I am trying to extract the PostgreSQL DB version for example: pgVer =3D [s.split() for s in os.popen("psql = --version").read().splitlines()] print pgVer[0] for i, var in enumerate(pgVer[0]): if i =3D=3D len(pgVer[0]) - 1: pgversion =3D var I would now like to pass =91pgversion=92 (where the value of pgversion = is 9.3.4) by reference, for example: I want to nuke /var/lib/postgresql/9.3.4/main/data , however = programatically I want it to be as: /var/lib/postgresql//main/data Any help is appreciated. Thanks Satish= --Apple-Mail=_48C16828-C097-4FD6-9576-401F77D302E6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 Hello = experts,

I have a burning question on how to pass = variable by reference in Python. I understand that  the data type = has to be mutable.

For example, here=92s the = issue I am running in to:

I am trying to = extract the PostgreSQL DB version for = example:

pgVer =3D [s.split() for s in = os.popen("psql --version").read().splitlines()]
  =   print pgVer[0]
    for i, var in = enumerate(pgVer[0]):
   if i =3D=3D = len(pgVer[0]) - 1:
   pgversion =3D= var

I would now like to pass = =91pgversion=92 (where the value of pgversion is 9.3.4) by reference, = for example:

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.

Thanks
Satish
= = --Apple-Mail=_48C16828-C097-4FD6-9576-401F77D302E6--