Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Steven D'Aprano
On Sun, 14 Jun 2015 04:11:59 +0200, Laura Creighton wrote: > In a message of 14 Jun 2015 01:59:10 +, "Steven D'Aprano" writes: >>On Sat, 13 Jun 2015 14:09:48 -0700, C.D. Reimer wrote: >> >>> On 6/13/2015 1:59 PM, Laura Creighton wrote: Idle is written in pure python. Steal from: htt

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread C.D. Reimer
Here's my code and output for the curious. I'm sure someone will come up with a five-line version. :) import os, time def main(): def_str = 'def ' line_limit = 5 call_tally = [] import_str = 'from bg_helper import ' path = 'scripts' startTime = time.time()

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Laura Creighton
In a message of 14 Jun 2015 01:59:10 +, "Steven D'Aprano" writes: >On Sat, 13 Jun 2015 14:09:48 -0700, C.D. Reimer wrote: > >> On 6/13/2015 1:59 PM, Laura Creighton wrote: >>> Idle is written in pure python. Steal from: >>> https://hg.python.org/cpython/file/74d182cf0187/Lib/idlelib/ >GrepDial

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Steven D'Aprano
On Sat, 13 Jun 2015 14:09:48 -0700, C.D. Reimer wrote: > On 6/13/2015 1:59 PM, Laura Creighton wrote: >> Idle is written in pure python. Steal from: >> https://hg.python.org/cpython/file/74d182cf0187/Lib/idlelib/ GrepDialog.py >> if you do not have a copy locally. > > I've been using Notepad++ (

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Mark Lawrence
On 13/06/2015 20:53, C.D. Reimer wrote: On 6/13/2015 12:31 PM, Chris Angelico wrote: Depending on your requirements, it could be anywhere from easy to hard. Good luck:) I don't have grep on my Windows machine. Writing a script might be easier. http://getgnuwin32.sourceforge.net/ might come

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread C.D. Reimer
On 6/13/2015 1:59 PM, Laura Creighton wrote: Idle is written in pure python. Steal from: https://hg.python.org/cpython/file/74d182cf0187/Lib/idlelib/GrepDialog.py if you do not have a copy locally. I've been using Notepad++ (Windows) and TextWrangler (Mac) for over a decade now. Idle may be p

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Laura Creighton
In a message of Sat, 13 Jun 2015 13:45:10 -0700, "C.D. Reimer" writes: >On 6/13/2015 1:02 PM, Terry Reedy wrote: >> If you have a normal Python installation, you do. Idle's Find in >> Files is a grep function with a gui interface. > >I have Notepad++ on Windows. The find function for that program

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread C.D. Reimer
On 6/13/2015 1:02 PM, Terry Reedy wrote: If you have a normal Python installation, you do. Idle's Find in Files is a grep function with a gui interface. I have Notepad++ on Windows. The find function for that program does the same thing. If I have a working Mac, Text Wrangler does the same th

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread C.D. Reimer
On 6/13/2015 12:58 PM, Chris Angelico wrote: Hmm, I think the Windows 'find' command can do the same sort of job. Though it's not hard to grab a Windows port of grep and use that. Should be easier than writing your own script. Writing the script would be easier for me since I'll be cobbling to

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Laura Creighton
In a message of Sat, 13 Jun 2015 12:53:43 -0700, "C.D. Reimer" writes: >On 6/13/2015 12:31 PM, Chris Angelico wrote: >> Depending on your requirements, it could be anywhere from easy to >> hard. Good luck:) > >I don't have grep on my Windows machine. Writing a script might be easier. Does Idle ru

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Terry Reedy
On 6/13/2015 3:53 PM, C.D. Reimer wrote: On 6/13/2015 12:31 PM, Chris Angelico wrote: Depending on your requirements, it could be anywhere from easy to hard. Good luck:) I don't have grep on my Windows machine. Writing a script might be easier. If you have a normal Python installation, you

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Chris Angelico
On Sun, Jun 14, 2015 at 5:53 AM, C.D. Reimer wrote: > On 6/13/2015 12:31 PM, Chris Angelico wrote: >> >> Depending on your requirements, it could be anywhere from easy to >> hard. Good luck:) > > > I don't have grep on my Windows machine. Writing a script might be easier. > > Each file has a impo

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread C.D. Reimer
On 6/13/2015 12:31 PM, Chris Angelico wrote: Depending on your requirements, it could be anywhere from easy to hard. Good luck:) I don't have grep on my Windows machine. Writing a script might be easier. Each file has a import statement for the helper file: from bg_helper import replay_g

Re: Is there a utility to tally function calls from other files?

2015-06-13 Thread Chris Angelico
On Sun, Jun 14, 2015 at 5:10 AM, C.D. Reimer wrote: > I'm converting 101 BASIC games from an old book > (http://www.atariarchives.org/basicgames/) into Python scripts. After a > dozen conversions, I've created a helper file for common functions (i.e., > pick_card(), replay_game() and roll_dice()).

ANN: psutil 3.0.0 is out

2015-06-13 Thread Giampaolo Rodola'
Hi there folks, I'm pleased to announce release 3.0.0 release of psutil: http://grodola.blogspot.com/2015/06/psutil-30.html === About === psutil (python system and process utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, d

Re: OT ish Blocking telemarketers

2015-06-13 Thread alister
On Sat, 13 Jun 2015 08:53:35 -0600, Michael Torrie wrote: > On 06/13/2015 08:42 AM, alister wrote: >> On Fri, 12 Jun 2015 19:47:18 -0600, Michael Torrie wrote: >> >>> On 06/12/2015 04:20 PM, Seymore4Head wrote: Is there a program what runs on Windows that uses a national blacklist to bl

Is there a utility to tally function calls from other files?

2015-06-13 Thread C.D. Reimer
Greetings, I'm converting 101 BASIC games from an old book (http://www.atariarchives.org/basicgames/) into Python scripts. After a dozen conversions, I've created a helper file for common functions (i.e., pick_card(), replay_game() and roll_dice()). The functions for card and dice games are o

Re: Path, strings, and lines

2015-06-13 Thread MRAB
On 2015-06-13 05:48, Malik Rumi wrote: On Friday, June 12, 2015 at 3:31:36 PM UTC-5, Ian wrote: On Fri, Jun 12, 2015 at 1:39 PM, Malik Rumi wrote: > I am trying to find a list of strings in a directory of files. Here is my code: > > # -*- coding: utf-8 -*- > import os > import fileinput > > s2

Re: zip as iterator and bad/good practices

2015-06-13 Thread Steven D'Aprano
On Sat, 13 Jun 2015 13:48:45 +0100, Oscar Benjamin wrote: > On 13 June 2015 at 08:17, Steven D'Aprano > wrote: >> But an easier way is: >> >> Test = [1, 2] >> Test.extend(Test) >> print(Test) > > I can't see anything in the docs that specify the behaviour that occurs > here. Neither do I, but

Re: OT ish Blocking telemarketers

2015-06-13 Thread Michael Torrie
On 06/13/2015 08:42 AM, alister wrote: > On Fri, 12 Jun 2015 19:47:18 -0600, Michael Torrie wrote: > >> On 06/12/2015 04:20 PM, Seymore4Head wrote: >>> Is there a program what runs on Windows that uses a national blacklist >>> to block phone calls? >> >> I'm sure you could install and use the Aste

Re: OT ish Blocking telemarketers

2015-06-13 Thread Michael Torrie
On 06/12/2015 04:20 PM, Seymore4Head wrote: > Is there a program what runs on Windows that uses a national blacklist > to block phone calls? You could port your number into Google Voice and then forward that to your cell phone or land line. You can screen all calls if you want (direct them to voi

Re: OT ish Blocking telemarketers

2015-06-13 Thread alister
On Fri, 12 Jun 2015 19:47:18 -0600, Michael Torrie wrote: > On 06/12/2015 04:20 PM, Seymore4Head wrote: >> Is there a program what runs on Windows that uses a national blacklist >> to block phone calls? > > I'm sure you could install and use the Asterisk PBX software, and I bet > people have made

Re: OT ish Blocking telemarketers

2015-06-13 Thread hamilton
On 6/12/2015 9:47 PM, Seymore4Head wrote: Yes I have tried the DNCR. It didn't help. The calls are not coming from the US although the caller ID says they are. So you want to "block" calls from a faked number ?!? ( do you have a good program to select lotto numbers?? :-) On my cell phone,

Re: zip as iterator and bad/good practices

2015-06-13 Thread Oscar Benjamin
On 13 June 2015 at 08:17, Steven D'Aprano wrote: > On Sat, 13 Jun 2015 13:32:59 +0800, jimages wrote: > >> I am a newbie. I also have been confused when I read the tutorial. It >> recommends make a copy before looping. Then I try. >> #-- >> Test = [1, 2] >> For i in Test: >

Re: Testing random

2015-06-13 Thread Mark Lawrence
On 12/06/2015 23:00, Ian Kelly wrote: On Fri, Jun 12, 2015 at 3:32 PM, Thomas 'PointedEars' Lahn wrote: Ian Kelly wrote: The probability of 123456789 and 1 are equal. The probability of a sequence containing all nine numbers and a sequence containing only 1s are *not* equal. There i

Re: Passing new fields to an object

2015-06-13 Thread Peter Otten
Steven D'Aprano wrote: > On Fri, 12 Jun 2015 16:53:08 +0100, Paulo da Silva wrote: > >> I would like to do something like this: >> >> class C: >> def __init__(self,**parms): >> ... >> >> c=C(f1=1,f2=None) >> >> I want to have, for the object >> self.f1=1 >> self.f2=None >> >> for an arbitrary

Re: How may I Integrate Python Code with REST

2015-06-13 Thread subhabrata . banerji
On Saturday, June 13, 2015 at 2:17:43 AM UTC+5:30, Laura Creighton wrote: > In a message of Fri, 12 Jun 2015 10:52:19 -0700, w > rites: > >Dear Group, > > > >I wrote a Python code. In the code there are two modules where we may insert > >data from outside. They are updating some training module a

Re: zip as iterator and bad/good practices

2015-06-13 Thread Steven D'Aprano
On Sat, 13 Jun 2015 13:32:59 +0800, jimages wrote: > I am a newbie. I also have been confused when I read the tutorial. It > recommends make a copy before looping. Then I try. > #-- > Test = [1, 2] > For i in Test: > Test.append(i) > #-- You don