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


Groups > comp.lang.python > #36821

Re: Finding the variables (read or write)

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'debugging': 0.05; 'python': 0.09; '###': 0.09; 'received:mail-vb0-f46.google.com': 0.09; '(read': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.17; 'have:': 0.17; 'instance': 0.17; 'instance,': 0.17; 'variables': 0.17; '(in': 0.18; 'jan': 0.18; 'received:209.85.212.46': 0.18; 'question.': 0.20; 'written': 0.20; "i'd": 0.22; 'example': 0.23; '15,': 0.23; 'statement': 0.23; 'header:In-Reply-To:1': 0.25; '(which': 0.26; 'am,': 0.27; '(3)': 0.27; 'c++': 0.27; 'to?': 0.27; 'message- id:@mail.gmail.com': 0.27; 'lines': 0.28; 'received:209.85.212': 0.28; 'python).': 0.29; 'case,': 0.29; 'definition': 0.29; 'function': 0.30; '(2)': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; '(1)': 0.34; 'received:209.85': 0.35; 'tool': 0.36; 'subject: (': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'state.': 0.71; '2013': 0.84; 'etc,': 0.84; 'subject:read': 0.84; 'subject:write': 0.84; 'fibonacci': 0.91; 'write:': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=/hFBaK9qCHZyKD3hkcDBfhpGCxQb2fe0bo3IKTDcAKE=; b=Hzb5PC3nmnUv7tTu31yCgKEIBFI545DLKLa116NlNxKH8bHnZdblIqC5uA2KZ9+hXm 83KJv2RoGwSufLKeYs/+p0Rd/Fg6yMsZp1jI0wx/DXP7SGwB0BauLP4OB/afETXBHv2R QWTXe7AWL/ktbAUSIa6hD8FYLi3BnKmSKqYhTxZt/J6r/VRqj2YUzdtopHTLVIbPUET+ okAs8L1WSmkVWyPLty8MohzP5YY1t1trAkGPeTdo7SZdOgsbqeW/nQfJPVxUUHAhAidf 4OGR5bFp0maE7tqD2tlGjMe9TfUxioBVSG45vSRDJ8GWKM21TyijifDBTvjCFPEpkL2N ymJg==
MIME-Version 1.0
In-Reply-To <46c8a630-de27-41dc-8b8b-1951ba747447@googlegroups.com>
References <46c8a630-de27-41dc-8b8b-1951ba747447@googlegroups.com>
Date Tue, 15 Jan 2013 08:28:28 +1100
Subject Re: Finding the variables (read or write)
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.520.1358198911.2939.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358198911 news.xs4all.nl 6903 [2001:888:2000:d::a6]:49715
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36821

Show key headers only | View raw


On Tue, Jan 15, 2013 at 6:48 AM,  <servekarimi@gmail.com> wrote:
> I'd like to develop a small debugging tool for python programs.In Dynamic Slicing How can I find the variables that are accessed in a statement? And find the type of access (read or write) for those variables (in Python).
> ### Write: A statement can change the program state.
> ### Read : A statement can read the program state .
> **For example in these 4 lines we have:
> (1) x = a+b    => write{x} & read{a,b}
> (2) y=6        => write{y} & read{}
> (3) while(n>1) => write{} & read{n}
> (4) n=n-1      => write{n} & read{n}

An interesting question. What's your definition of "variable"? For
instance, what is written and what is read by this statement:

self.lst[2] += 4

Is "self.lst" considered a variable? (In C++ etc, this would be a
member function manipulating an instance variable.) Or is "self" the
variable? And in either case, was it written to? What about:

self.lst.append(self.lst[-1]+self.lst[-2])

(which might collect Fibonacci numbers)?

ChrisA

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


Thread

Finding the variables (read or write) servekarimi@gmail.com - 2013-01-14 11:48 -0800
  Re: Finding the variables (read or write) Chris Angelico <rosuav@gmail.com> - 2013-01-15 08:28 +1100
  Re: Finding the variables (read or write) Chris Kaynor <ckaynor@zindagigames.com> - 2013-01-14 13:37 -0800
  Re: Finding the variables (read or write) Terry Reedy <tjreedy@udel.edu> - 2013-01-14 16:42 -0500
  Re: Finding the variables (read or write) Chris Angelico <rosuav@gmail.com> - 2013-01-15 08:46 +1100

csiph-web