Re: [Tutor] OpenMP

2010-10-09 Thread Emile van Sebille
and GIL (global interpreter lock). HTH, Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] OpenMP

2010-10-10 Thread Emile van Sebille
state simulation across tens of thousands of CPUs" Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-10 Thread Emile van Sebille
lts of split to variable names. For example, ky,val = "A-01, 1278".split(",") sets ky to A-01 and val to 1278. So, you should be able to create an empty dict, and for each line in your file set the dict entry for that line. Why don't you start there and show us wha

Re: [Tutor] dictionary and more

2010-10-11 Thread Emile van Sebille
destin you're assigning the _results_ of the functions to your dictionary. You probably want to leave off the parens when declaring the functions. Further, your functions probably need to return something -- add return statements if you want the results. HTH, Emile

Re: [Tutor] Merging Text Files

2010-10-13 Thread Emile van Sebille
wo and build a dict from the Protein IDs, then pass file one, break out the Protein ID, and write the concatenated result out. Something like: [pyseudocode] PIDs = {} for proteinVals in FileTwo: ID = proteinVals.split()[0] PIDS[ID]=proteinVals for eachline in FileOne: ID = proteinVals.split()[1]

Re: [Tutor] join question

2010-10-14 Thread Emile van Sebille
On 10/14/2010 6:50 AM Roelof Wobben said... Hello, I found this answer to a problem for me : print ''.join([zf.getinfo('%s.txt' % p).comment for p in zpp]) So I thought that this would be the same : for p in zpp: test = zf.getinfo(p).comment This isn't transcribed properly

Re: [Tutor] Merging Text Files

2010-10-14 Thread Emile van Sebille
On 10/14/2010 7:48 AM Ara Kooser said... Morning all, I took the pseudocode that Emile provided and tried to write a python program. I may have taken the pseudocode to literally. So what I wrote was this: xml = open("final.txt",'r') gen = open("final_gen.txt",&

Re: [Tutor] 'module' object has no attribute (setting a class attribute)

2010-10-16 Thread Emile van Sebille
know there was such a convention. Serves me right for being self-taught and self-employed Pep 8 is the generally accepted style guide. http://www.python.org/dev/peps/pep-0008/ Although there are few recommendations I don't follow, it's good to write in the style most everyone else

Re: [Tutor] Problem Passing VARs to Python from PHP & capturing return string

2010-10-23 Thread Emile van Sebille
orks and you're having trouble with the php invocation and return values, isn't this more of a php issue? Most of us here do our web serving with python... Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change s

Re: [Tutor] What is random.triangular() used for

2010-10-24 Thread Emile van Sebille
;""The triangular distribution is often used in ill-defined problems where the underlying distribution is not known, but some knowledge of the limits and mode exists. Often it is used in simulations.""" HTH, Emile ___ Tutor maill

Re: [Tutor] Problem Passing VARs to Python from PHP & capturing return string

2010-10-26 Thread Emile van Sebille
On 10/26/2010 12:55 PM Roy Hinkelman said... I am posting here as well as a PHP list since I am now getting an odd python error. The traceback of the python error would help us diagnose the problem but it's not been included. Can you paste in the actual traceback?

Re: [Tutor] Summing up numbers in a file

2010-10-26 Thread Emile van Sebille
a loop to print the results. What have you got so far? Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Which string operation is best to extract text from database string?

2010-10-27 Thread Emile van Sebille
quot; from this string of text? Assuming you've got that string in variable text, and that "SERVICE_NAME =" is there to be found, I'd do something like servicename = text.split("SERVICE_NAME =")[1].split(")")[0] Emile __

Re: [Tutor] pythonpath

2010-11-01 Thread Emile van Sebille
files and other methods used. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] if statement

2010-11-02 Thread Emile van Sebille
;: ")) for In in range(0,NumItems): print(Entries[In]) confirmed = int(input("Are you happy with this? (y/n): ") The line above (which would appear to set confirmed to an int) doesn't have matching parens, which causes an error to be trapped elsewhere. Emile _

Re: [Tutor] Too different 2.6 vs 2.7?

2010-11-08 Thread Emile van Sebille
to 2.7 to provide an easier upgrade path. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Columnar Transposition Cipher question

2010-11-09 Thread Emile van Sebille
On 11/9/2010 1:29 PM Steven D'Aprano said... I'm pretty sure I tried it, once, but I might be confabulating. Cool -- I learned a new word today! I had to look it up as I thought you were profabulating... :) Emile ___ Tutor maillist

Re: [Tutor] variables question.

2010-11-10 Thread Emile van Sebille
t and older version is 1) search in local-global-builtin, and 2) if you assign to it in a scope, it's local to that scope. So, blah and foo below are visible in all the functions except any that specifically assign to blah or foo. HTH, Emile I have a monolothic script with a

Re: [Tutor] What is a "state variable"?

2010-11-11 Thread Emile van Sebille
hat state. By putting state variables into member fields, they are accessible to all the methods of the class without having to be passed as parameters." So, by his own definition state variables are parameters. Emile ___ Tutor maillist - Tutor@pyt

Re: [Tutor] new to python

2010-11-18 Thread Emile van Sebille
priate starting point... http://docs.activestate.com/activepython/2.4/pywin32/html/com/win32com/HTML/QuickStartServerCom.html Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] code quest

2010-11-20 Thread Emile van Sebille
On 11/20/2010 11:03 AM Kirk Bailey said... OK, I need to create or find a function that will return a list of DIRECTORIES (only) which are under 'the current directory'. Anyone got some clue on this? Please advise. Use os.walk Emile Help on function walk in module os: walk(to

Re: [Tutor] List help

2010-11-20 Thread Emile van Sebille
#x27;, 'l', 'o'] >>> list("1234") ['1', '2', '3', '4'] You then compare a string to the numbers 2,4,6,8,10 making the test line: if a=="2" or a=="4 or a=="6"

Re: [Tutor] lists, arrays and saving data

2010-11-21 Thread Emile van Sebille
year of data at ten minute intervals takes thee seconds on my PC. Below is how I refactored things. Emile - import datetime, time from math import sin from math import cos from math import degrees from math import radians from math import acos def getLocation(): print("Please s

Re: [Tutor] Simple counter to determine frequencies of words in a document

2010-11-21 Thread Emile van Sebille
rns the element in position [1] thereof. HTH, Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fw: Installing Pyserial for Python27 on Win 7

2010-11-22 Thread Emile van Sebille
See http://sourceforge.net/tracker/index.php?func=detail&aid=2921957&group_id=46487&atid=446302 where it's explained that this bug won't get fixed, but that you can install from sources. Emile On 11/22/2010 1:08 PM ALAN GAULD said... Forwarding to the list Please s

Re: [Tutor] Fw: Installing Pyserial for Python27 on Win 7

2010-11-22 Thread Emile van Sebille
On 11/22/2010 3:05 PM John Smith said... Hi, Emile - Install from sources? What is that? see http://pyserial.sourceforge.net/pyserial.html#installation the From Source section. I'm not sure what else may be required but it should help get you started. Emile I searched for that p

Re: [Tutor] Fw: Installing Pyserial for Python27 on Win 7

2010-11-23 Thread Emile van Sebille
; that were in common use then. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tutor Digest, Vol 81, Issue 78

2010-11-23 Thread Emile van Sebille
On 11/23/2010 7:30 AM Wangolo Joel said... I NO LONGER WANT YOUR TUTORIAL you can unsubscribe at http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://

Re: [Tutor] "if n % 2 == 0" vs. "if not n % 2" compared for speed:aesthetics lose

2010-11-23 Thread Emile van Sebille
http://tutoree7.pastebin.com/iragLgDz>. Did you try: if n % 2: pass else: do it here? or def x2(n): return not (n % 2) Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] "if n % 2 == 0" vs. "if not n % 2" compared for speed: aesthetics lose

2010-11-23 Thread Emile van Sebille
On 11/23/2010 1:26 PM Richard D. Moores said... So what's the connection with the tests I've run? It's an even/odd test. [ii&1 for ii in range(1,1000,2)] [ii&1 for ii in range(0,1000,2)] Emile ___ Tutor maillist - Tutor@py

Re: [Tutor] Proxies/Interceptors for file-like objects

2009-02-18 Thread Emile van Sebille
a.mything() it's my thing >>> a.write("this is a test") >>> a.flush() >>> a.close() >>> open(r'c:\testfile','r').read() 'this is a test' >>> Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] verify the email

2009-02-20 Thread Emile van Sebille
. Further, mail systems (and administrators) are reluctant to provide spammers an easy way to validate email lists, so where doors may be opened, you're likely to find them closed anyway. Emile ___ Tutor maillist - Tutor@python.org http://

Re: [Tutor] Passing perimeters in dictionary values?

2009-02-24 Thread Emile van Sebille
nathan virgil wrote: Erm, it's still not working... if selection in choices: choice = choices[selection] choice[0](choice[1]) s/bchoice[0]() main() ("\n\nPress the enter key to exit.")

Re: [Tutor] could someone explain why this happens to me.

2009-03-07 Thread Emile van Sebille
use a copy form of assignment, eg List2 = List1[:] Note however that this form of copy doesn't copy nested structures and you'll have similar issues in that case. Look into deepcopy. Emile List1=[1,2,3] List2=List1 List2.reverse() print(List2) [3, 2, 1] print(List1) [3, 2, 1]

Re: [Tutor] help

2009-03-13 Thread Emile van Sebille
Sanhita Mallick wrote: help YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING . AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND DOWN A GULLY. Emile ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] TypeError: dict objects are unhashable

2009-03-14 Thread Emile van Sebille
also match items. but for all DA's and DB's below, is that true? >>> a = range(52) >>> import string >>> DA = dict(zip(a,string.letters)) >>> DB = dict(zip(a,string.letters)) >>> DA == DB True >>> DA.items() == DB.items() True >&

Re: [Tutor] Need Assistants with Python Please

2009-03-15 Thread Emile van Sebille
oduction.html HTH, Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to connect to an email server?

2009-03-16 Thread Emile van Sebille
e "", line 1, in connect error: (10061, 'Connection refused') The server again refuses your connection attempt... What should I do? I'd start by pinging the server and running nmap on it. Forget imap if your goal is sending mail. If you don't see po

Re: [Tutor] Adding key, value to Dictionary

2009-03-27 Thread Emile van Sebille
time the application is live, although it's also often cited as a gotcha... and def get_todo(todo=None): if todo==None: todo = {} ... Both the above allow you to pass in a starting todo dict, so you could juggle multiple todo dicts... HTH,

Re: [Tutor] Shelve doesn't free up memory

2009-03-30 Thread Emile van Sebille
Timo wrote: # Results file import shelve def read_result(person): results = [] s = shelve.open(RESULTFILE) try: results = s[person] Maybe passing this out prevents s from being garbage collected? Emile except KeyError: #print "No results for this p

Re: [Tutor] Shelve doesn't free up memory

2009-03-31 Thread Emile van Sebille
Timo wrote: Emile van Sebille schreef: Timo wrote: # Results file import shelve def read_result(person): results = [] s = shelve.open(RESULTFILE) try: results = s[person] Maybe passing this out prevents s from being garbage collected? What do you mean by passing out

Re: [Tutor] toggle through a list

2009-04-01 Thread Emile van Sebille
-- it isn't the index if num!=data[i]: here you're using i as though it were an index -- maybe use if num!=i Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] ping

2009-04-03 Thread Emile van Sebille
ping! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Can't run this script while I'm logged off of Windows XP

2009-04-03 Thread Emile van Sebille
e. There're plenty of examples out there. Maybe you'll have better luck with that. Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Lists--A Suggestion

2009-04-08 Thread Emile van Sebille
Wayne Watson wrote: Perhaps the Pyton organization could produce their mail lists, if they have any control over them. Maybe that's the source of the inconsistency? Has anyone pointed out that posting through gmane eliminates the inconsistency?

Re: [Tutor] Accessing a list inside a class...

2009-04-09 Thread Emile van Sebille
rned -- that'll probably help clear things up. If it's really a list type, you don't access those with keys, so self.opt['inifile'] would fail. test.load_ini() HTH, Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Finding all IP addresses associated with a host

2009-04-09 Thread Emile van Sebille
d a link that led me to http://pypi.python.org/pypi/netifaces/0.3 How far does that get you? HTH, Emile I realize I can call ifconfig and then munge the output with awk, but that seems messy, and before I tried that I though I would ask around. To give a bit more information, I'm w

Re: [Tutor] Reading a "Raw "Image File

2009-04-12 Thread Emile van Sebille
re question, when I tried (no 'wb') assuming you mean 'rb' above read(size=307200), why di read balk at size, syntactically. read terminates upon first end on line character encountered HTH, Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Here's something to talk about (Weidner, Ronald)

2009-04-15 Thread Emile van Sebille
rs. ActivePython 2.4.1 Build 247 (ActiveState Corp.) based on Python 2.4.1 (#65, Jun 20 2005, 17:01:55) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. c

Re: [Tutor] for loop

2009-04-16 Thread Emile van Sebille
-- changing the name of the variable used to hold results shouldn't change the outcome. I cannot reconcile them. Can someone explained to me please? If you expect something different, then you need to write a different program. What did you want to happen? Emile *>>> for let

Re: [Tutor] PDF to text conversion

2009-04-21 Thread Emile van Sebille
xt -v pdftotext version 2.01 Copyright 1996-2002 Glyph & Cog, LLC [r...@fcfw2 /]# cat /etc/issue Red Hat Linux release 9 (Shrike) HTH, Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] understanding urllib.urlopen

2009-04-23 Thread Emile van Sebille
johnf wrote: But if I attempt this urllib.urlopen( "http://maps.google.com?q='18 Tadlock Place Woodland CA'" ) it always fails. What do you get? I don't get an error. Emile ___ Tutor maillist - Tutor@python.org http:

Re: [Tutor] # what do I do now to kill the the Windows program which has finished its work?

2009-04-25 Thread Emile van Sebille
messy. :) Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How many types of the constructor

2009-04-27 Thread Emile van Sebille
def __init__(self):pass ... def __gt__(self,other): return True ... >>> t = Test() >>> t>3 True >>> t>0 True >>> t>"hello" True >>> And you may even find out why the following work as well... >>> t<"hello&q

Re: [Tutor] Regular Expresions instances

2009-04-28 Thread Emile van Sebille
Emilio Casbas wrote: Hi, following the example from http://docs.python.org/3.0/howto/regex.html ...from version 3.0 docs... If I execute the following code on the python shell (3.1a1): import re p = re.compile('ab*') p I get the msg: <_sre.SRE_Pattern object at 0x013A3440> ... is the

Re: [Tutor] Regular Expresions instances

2009-04-28 Thread Emile van Sebille
Emile van Sebille wrote: Emilio Casbas wrote: Hi, following the example from http://docs.python.org/3.0/howto/regex.html ...from version 3.0 docs... If I execute the following code on the python shell (3.1a1): import re p = re.compile('ab*') p I get the msg: <_sre.SRE_P

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread Emile van Sebille
regex are notoriously hard to master and often obscure. Seconded. I almost always find it faster and easier to simply write the python routine I need rather than suffer the pain that results from getting the regex to actually perform what's nee

Re: [Tutor] quick question to open(filename, 'r') vs. file(filename, 'r')

2009-05-04 Thread Emile van Sebille
on why Python allows such ambiguity here? Backwards compatibility. The file type was introduced in python 2.2, before which there was open. Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to reference a function itself when accessing its private functions?

2009-05-04 Thread Emile van Sebille
easy way -- ie, you know where to look and what name to use. You can discover the name using the inspect module, but it can get ugly. If you're interested start with... from inspect import getframeinfo, currentframe HTH, Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Conversion question

2009-05-04 Thread Emile van Sebille
: "414243440d0a" Is there a way in Python to say this is a string of HEX characters like Perl's pack? Right now I have to take the string and add a \x to every two values i.e. \x41\x42... import binascii binascii.a2b_hex(&#x

Re: [Tutor] Parsing Question

2009-05-09 Thread Emile van Sebille
g from the file), then look into indexing the resulting list objects. That should focus your attentions... Emile I have a text file that looks like this: 1 the 126 name 2 of 127 very 3 to 128 through 4 and 129 just 5 a 130 form 6 in 131 much 7 is 132 great etc... Each has 2 numbers an

Re: [Tutor] Parsing Question

2009-05-10 Thread Emile van Sebille
pairs[2:4]) ).items() )] ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'] Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to control the not existent keys in a dict

2009-05-10 Thread Emile van Sebille
not testing the inputs, you're testing if is_in_dict _is_ (which of course it is as it's defined and ergo is) -- you need to pass it your parameters, ie, 'is_in_dict(nombre,dictionary)' return 1 return 0 def is_in_dict(nom,dict): also -- it&#x

Re: [Tutor] cannot subclass imported type

2009-05-13 Thread Emile van Sebille
On 5/13/2009 8:32 AM spir said... Hello, I wanted to subclass the type Window of pyGTK for main app windows (for the obvious reason that they always contain the same init and end code) and run into an unexpected problem: = import pygtk pygtk.require('2.0') import gt

Re: [Tutor] Sorting a list

2009-05-13 Thread Emile van Sebille
e the last entry to the front -- >>> a = [4, 6, 'word', 3, 9] >>> a.sort() >>> a.insert(0,a.pop()) >>> a ['word', 3, 4, 6, 9] >>> HTH, Emile Now I want the word to be kept in the first location and the numbers to be sort

Re: [Tutor] odbc connection with python

2009-05-19 Thread Emile van Sebille
re info and examples. Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] clean text

2009-05-19 Thread Emile van Sebille
assuming it does the same thing... xlate = dict( (chr(c),chr(c)) for c in range(256)) xlate.update(control_char_map) def cleanRepr5(text): return "".join([ xlate[c] for c in text ]) Emile I did a test with random strings of typical length f

Re: [Tutor] clean text

2009-05-19 Thread Emile van Sebille
round. Like this? >>> print repr(''.join(chr(ii) for ii in range(20,40))) '\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'' >>> Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Emile van Sebille
def func3():return 3 flist = [func1,func2,func3] flist[0]() flist[1]() flist[2]() Emile I do not think Python has a branch indirect construct so I cannot use anything similar to that methodology. What is the best approach to take to solve this problem? Thank you for any assistance, hints

Re: [Tutor] Error installing review board on windows

2009-05-28 Thread Emile van Sebille
ation. Emile It fails saying it could not build PIL 1.1.6 because visual studio was not found on the system and but I have already installed the PIL 1.1.6 using binaries available on the site but review board fails to locate it and every time tries to download the PIL and fails while buildin

Re: [Tutor] python workspace

2009-06-02 Thread Emile van Sebille
HTH, Emile if any of you has ever used Matlab, i mean something really similar to its workspace, where all the user created variables are stored and constantly updated thank you ___ Tutor maillist - Tutor@python.org http://mail.python.org/ma

Re: [Tutor] python workspace

2009-06-02 Thread Emile van Sebille
On 6/2/2009 11:34 AM Gökhan SEVER said... In Ipython Good for IPYTHON -- I wasn't presuming that. Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python workspace -- vars() vs locals()

2009-06-03 Thread Emile van Sebille
On 6/3/2009 12:50 AM spir said... Le Tue, 02 Jun 2009 10:47:38 -0700, Emile van Sebille s'exprima ainsi: On 6/2/2009 8:54 AM roberto said... hello, i'd like to ask if there is anything in python which helps to see what variables have been defined and their type and their dimensio

Re: [Tutor] stripping 0's from 01's - 09's

2009-06-04 Thread Emile van Sebille
tter to have: 'Jun 4th 2009' How would you go about in doing this? Without reading the docs, you could just strip it out: formated_date = date_object.strftime(format).replace(" 0"," ") Emile Thanks _

Re: [Tutor] Python 2.2... os.exec catch stdout

2009-06-04 Thread Emile van Sebille
d return to the python script when I am done; but I do not seem to be able to execute read stdout; and all examples I have found on the net do not allow me to interact with the called program. Any pokes int he right direction? What O

Re: [Tutor] converting xls to csv

2009-06-06 Thread Emile van Sebille
delimiter=' ', quotechar='|') for f in files: do the open here for row in f: for cell in row: if pattern.search(cell): print ', '.join(row) Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] creating a range above & below a given number

2009-06-06 Thread Emile van Sebille
something like (untested): def within_range(number, median, threshold=5): return threshold-medianOf course, the ranges you're testing with are all integers, so you may want to check for that as well. Emile Thanks, ___ Tutor maillist - T

Re: [Tutor] converting xls to csv

2009-06-06 Thread Emile van Sebille
t='excel'] [optional keyword args]) for row in csv_reader: process(row) HTH, Emile On Sat, Jun 6, 2009 at 3:33 PM, Emile van Sebille wrote: On 6/6/2009 12:19 PM Nick Burgess said... Thank you. The data is pretty much random thro

Re: [Tutor] creating a range above & below a given number

2009-06-07 Thread Emile van Sebille
range(self, n, n2, threshold=5): return n == int(n) and ( n < n2+threshold or n > n2 + threshold) Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] creating a range above & below a given number

2009-06-07 Thread Emile van Sebille
On 6/7/2009 8:44 AM Emile van Sebille said... On 6/7/2009 7:08 AM Gonzalo Garcia-Perate said... the solution laid somewhere in between: def within_range(self, n, n2, threshold=5): if n in range(n2-threshold, n2+threshold+1) and n < n2+threshold or n > n2 + threshold : retur

Re: [Tutor] vpython compatibility

2009-06-07 Thread Emile van Sebille
here http://vpython.org/contents/download_windows.html and here http://vpython.org/contents/download_linux.html that they recommend python 2.5 or 2.6. I'd suspect that working beyond recommended compatibilities is for the bleeding edge developers. Most of Python3 still falls in that arena. Em

Re: [Tutor] creating a range above & below a given number

2009-06-07 Thread Emile van Sebille
On 6/7/2009 10:17 AM Gonzalo Garcia-Perate said... Emile, Kent thank you both for your reply, after sending my previous email I realised that it wasn't working as expected in all cases. this does work: def within_range_final(self, n, n2, threshold=5): return n in range(n2-threshol

Re: [Tutor] What is this kind of loop called

2009-06-07 Thread Emile van Sebille
bers(): for i in range(9549355543, 9549355560): numbers = i get(numbers) call_numbers() Is there a technical name for a loop like this? You mean like, automated junk call dialer? duck-and-cover... :) Emile thanks -david __

Re: [Tutor] Where is www.wxpython.org?

2009-06-08 Thread Emile van Sebille
?group_id=10718 Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What is nntp news reader address for this mailing list?

2009-06-09 Thread Emile van Sebille
posts on this mailing list. What is the nntp address for thsi mailing list? The news server is nntp://news.gmane.org/ Then subscribe to the lists you're interested in. Emile nntp://news.gmane.org/gmane.comp.python.tutor doesn't

Re: [Tutor] How do I do this in python?

2009-06-11 Thread Emile van Sebille
[1, 2, 3])] ... but watch out for composite objects... >>> show(d,e,a,b,L[0]) [('d', 4), ('e', 5), ('a', 1), ('b', 2), ('L', 1)] >>> D = dict([('d', 4), ('e', 5), ('a', 1), ('b', 2), ('L', 1)]) >>> D['L'] 1 >>> show(d,e,a,b,D['L']) [('d', 4), ('e', 5), ('a', 1), ('b', 2), ('D', 1)] I wouldn't rely on this, but it may be of some use and shows a little of the introspection abilities python provides. Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Simple factorial program

2009-06-11 Thread Emile van Sebille
") factorial = reduce(mul,range(1,number+1),1) Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Best Python Editor

2009-06-14 Thread Emile van Sebille
d fewer problems with it. :) My editor for the past ten years or so has been TextPad on windows with a variety of syntax plugins. (php,perl,python,pro5,postscript) Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Best Python Editor

2009-06-15 Thread Emile van Sebille
buggy. :) Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] which is better solution of the question

2009-06-16 Thread Emile van Sebille
On 6/16/2009 7:49 AM Kent Johnson said... How do you measure "better"? Speed, clarity, ...? ... or the first method you think of that gives the right result. Where else would you find your keys once you've found them? Emile ___

Re: [Tutor] Best Python Editor

2009-06-16 Thread Emile van Sebille
On 6/15/2009 12:14 PM Michael Powe said... On Mon, Jun 15, 2009 at 06:34:04AM -0700, Emile van Sebille wrote: I'm wondering if there might be documented benefits to migrating from my horse and buggy. :) Are you in a hurry to get somewhere? ;-) If 20 LOC/day is average nowadays, how

Re: [Tutor] New to programming and python first minimilistic program (Bottles of beer), , please comment!

2009-06-17 Thread Emile van Sebille
apabilities and see how short a program will give the same results. Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List Splicing

2009-06-17 Thread Emile van Sebille
On 6/17/2009 3:03 PM Robert Berman said... Greetings, I am working on a 'simple' algorithm to solve the problem called PRIME1 explained at http://www.spoj.pl/problems/PRIME1/. I do have an algorithm based on the Sieve of Eratosthenes and it does work as I am failing the project not because of

Re: [Tutor] List Splicing

2009-06-17 Thread Emile van Sebille
On 6/17/2009 4:48 PM Robert Berman said... Emile, Thank your for your comments. I do have a list running from 0-101. Yes, it is true, I only needed 0 - 10 and yes I will change it. However, if you use primearray you haven't posted the primearray code... However, for the

Re: [Tutor] List Splicing

2009-06-17 Thread Emile van Sebille
ildSieve(20) [0, 0, 2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 0, 13, 0, 0, 0, 17, 0, 19, 0] So I still don't know what primearray is/does. Emile The code is as follows: def BuildSieve(itemsin): TheSieve=list() TheSieve = range(0,itemsin+1) TheSieve[1]=0 for i in range(2,itemsin+1):

Re: [Tutor] Fast way to access items in a dictionary

2009-06-17 Thread Emile van Sebille
7 ... and when it isn't... >>> Timer("'E' in {'D':123}.keys()").timeit() 0.99194670371434768 >>> Timer("'E' in {'D':123}").timeit() 0.34795386410769424 >>> Emile accessing a key that does not exist w

Re: [Tutor] please help me

2009-06-18 Thread Emile van Sebille
://www.mobilenin.com/mobilepythonbook/examples/057-btchat.html Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Program Slicing / Trace

2009-06-18 Thread Emile van Sebille
statements through the code to track where something changes, then remove them once we're done. Sometimes I'll set a DEBUG variable or dict. I also use pdb as needed, eg import pdb; pdb.set_trace() Emile Not sure if the traceback module can be helpful here! Ch

Re: [Tutor] Eliminating consecutive duplicates in a list

2009-06-18 Thread Emile van Sebille
x,x[1:]+[-1]) if jj != ii] Emile ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Checking Syntax

2009-06-18 Thread Emile van Sebille
;ll need to increase indentation level after any lines ending in a colon that indicate the start of a block. This type of error can cause cryptic messages to the thrown up that don't always point to the actual problem. HTH, Emile #Validate the new feature class name for the output wo

<    1   2   3   4   5   6   >