Re: [Tutor] Which Python Script Editor of Choice?

2008-04-03 Thread Dave Kuhlman
his page will give you more choices than you want: http://en.wikipedia.org/wiki/Comparison_of_text_editors My favorites are: - Jed - Emacs - SciTE - Jedit (but only if you have lots of memory) Jed, Emacs, and SciTE are scriptable. SciTe, perhaps, is not. - Dave -- Dave Kuhlman http://www.rexx.com/~dk

Re: [Tutor] Question about global variables on modules

2008-04-07 Thread Dave Kuhlman
print t3() test() See http://docs.python.org/ref/global.html. Note that to *get* (not set) the value of a global variable from within a function, you do not need to use the global statement. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman _

[Tutor] Need suggestion / advice - controlling remote server

2008-04-17 Thread dave selby
nterface to ssh in and do the changes via shell commands, ie change config files, restarts deamons etc, should work OK. Is this acceptable ? How would you guys do it ? Thanks in advance Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-wor

Re: [Tutor] Debug C library in python program

2008-04-28 Thread Dave Kuhlman
" http://www.delorie.com/gnu/docs/gdb/gdb_191.html Hope this helps. It has been quite a while since I've done this, but I remember that it worked pretty slick. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman #!/bin/sh -v gdb -d /path/to/your/source/code -x test2.gdb python `ps

Re: [Tutor] Buffering in file.read()

2008-05-08 Thread Dave Kuhlman
ault, which is usually line buffered for tty devices and fully buffered for other files. If omitted, the system default is used." -- http://docs.python.org/lib/built-in-funcs.html#l2h-54 Looks to me that the buffering is done for you, but that you can control

Re: [Tutor] Buffering in file.read()

2008-05-12 Thread Dave Kuhlman
S Windows, you might look here: http://msdn.microsoft.com/en-us/library/86cebhfs(VS.80).aspx So, MS Windows seems to support it. - Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] listing classes

2008-05-20 Thread Dave Kuhlman
print inner_classes if __name__ == '__main__': test() Which prints out: [('A', )] [('B', ), ('C', ), ('__class__', )] - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman

[Tutor] doc string format ?

2008-06-08 Thread dave selby
Hi All, I am trying to improve my code quality and have started using doc strings. What format do you guys use for your doc strings ? I have 'made up' the following general format ... Cheers Dave def gen_vhost(kmotion_dir): """ Generate the kmotion vhost

[Tutor] clipping file to size ?

2008-06-09 Thread dave selby
how to clip the file to the newer smaller size without closing it and reopening it as a 'w' ? Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ___ Tutor mai

[Tutor] do I need f.close()

2008-06-10 Thread dave selby
ed an object name so am I right in thinking that as the object is 'reclaimed' close() is automatically called ? Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html

Re: [Tutor] do I need f.close()

2008-06-11 Thread dave selby
eilly as a refresher where there are multiple instances of suggesting that you do the exact opposite eg ... [line.rstrip() for line in open('myfile')] ... p361 for line in open('script1.py') ... p261& p276 where it is described as 'best practice' for reading files line

Re: [Tutor] Create file and input text

2008-06-29 Thread Dave Kuhlman
ust your users. They can over-write files. In a real application, you might want to do some checking on the file before opening it. Consider using something like this: if os.path.exists(filename): print 'Warning. File %s exists.' % filename else:

Re: [Tutor] Online class/education for Python?

2008-07-21 Thread Dave Kuhlman
o do it on your own, also take a look at: http://wiki.python.org/moin/BeginnersGuide http://wiki.python.org/moin/BeginnersGuide/NonProgrammers http://wiki.python.org/moin/BeginnersGuide/Programmers - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman

Re: [Tutor] where to report a bug?

2008-07-25 Thread Dave Kuhlman
27;ve written code with that bug myself. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List indexing problem

2008-07-26 Thread Dave Kuhlman
In [27]: IP Out[27]: [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]] In [28]: id(IP[0]) Out[28]: 13122016 In [29]: id(IP[1]) Out[29]: 13121152 In [30]: id(IP[2]) Out[30]: 13121800 - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman

[Tutor] Split string on 2 delimiters ?

2008-08-07 Thread dave selby
Hi all, Is there a neat way to split a string on either of two delimiters ie space and comma Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ___ Tutor maillist

[Tutor] importing path question

2008-08-09 Thread dave selby
t also needs to access scripts in 'core' kmotion2 directory | | core utilities So I need to import up the tree then back down. Is this possible ? Dave -- Please avoid sending me Word or PowerPoint attachments

[Tutor] pwd lib probs

2008-08-18 Thread dave selby
attribute 'pw_gid' [EMAIL PROTECTED]:~/kmotion2$ sudo ./install.py What am I missing ? Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ___ Tutor maillist - T

[Tutor] named pipe problem

2008-08-20 Thread dave selby
Hi All, I am trying to get a named pipe working, I have already made a fifo [EMAIL PROTECTED]:/usr/local/bin$ ls -al /home/dave/kmotion2/www/pipe_func prw-rw 1 dave www-data 0 2008-08-20 20:25 /home/dave/kmotion2/www/pipe_func [EMAIL PROTECTED]:/usr/local/bin$ but when I execute my test

Re: [Tutor] Python Working Environment, Checkout, Compare (diff), ...

2008-10-13 Thread Dave Kuhlman
.dll) and not an emulation layer like that provided by Cygwin tools." - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] stopping threads ?

2008-11-03 Thread dave selby
Hi All, Why when I use threads in my app (I know they are evil ...lol) does it not stop with ctrl-c, I have to use ctrl-z ? Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html

Re: [Tutor] Graph theory

2008-12-04 Thread Dave Kuhlman
hon.org/doc/essays/graphs/ > > Also googling "python graph" finds many alternatives. And, if you are also interested in the visual display of graphs, then look for graphviz and python-pygraphviz. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman

Re: [Tutor] passing unknown no of arguments

2009-02-05 Thread Dave Rankin
erface. I didn't immediately see anything about performance issues, reliability, gotchas, or any other significant drawbacks, but if the original poster really did mean Python code that runs in the browser instead of on the server, maybe this approach would help them. -Dave ___

[Tutor] totally stumped on signal code, wont work in this instance

2009-02-06 Thread dave selby
e$ ./kmotion_ptzd.py Hangup d...@main-system:~/kmotion2/core$ OK so I would have expected signal_hup to have intercepted the signal and printed 'sighup :)' and also not have exited in this case. Any ideas, I can solve most of my python probs but this one has me stumped. Cheers Dave

Re: [Tutor] If os.path.lexists() isn't working properly

2010-11-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Susana Iraiis Delgado Rodriguez wrote: Hello Peter! I added the line you suggested me and found out that I was just searching for the filenames without pointing to a specific directory, so Python took its directory (Python26) as default. After that I need to add a '\'

Re: [Tutor] If os.path.lexists() isn't working properly

2010-11-25 Thread Dave Angel
On 11/25/2010 09:20 AM, Susana Iraiis Delgado Rodriguez wrote: Hi Dave! Thank you for your suggestion I haven't prevent the problems you're describing, but I'm newbie in this stuff so, where should I repalce the code? Thank you again! 2010/11/24 Dave Angel On 01/-10/-28163 0

Re: [Tutor] Question about the "main" Python help list

2010-12-04 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Joel Schwartz wrote: I meant the Python-Help mailing list (http://mail.python.org/mailman/listinfo/python-help), which is described on the Python mailing list page (http://mail.python.org/mailman/listinfo) as "Expert volunteers answer Python-related questions." I guess

Re: [Tutor] Feedback on coding style

2010-12-08 Thread Dave Angel
On 01/-10/-28163 02:59 PM, howit...@archlinux.us wrote: Hi. For the past week, I've been following an online Python guide named: 'Learn Python the Hard Way'. I'm very happy with it as it gives a lot of freedom to explore. However, due to this I have no idea if I'm thinking the right way. That's

Re: [Tutor] permutations?

2010-12-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Francesco Loffredo wrote: On 03/12/2010 1.32, Steven D'Aprano wrote: mylist = [x for x in mylist if x != "something"] Up to this point, I share experiences and solution. But the next point did thrill me: If you really need to modify the list in place, and not just

Re: [Tutor] doing maths on lists

2010-12-20 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Chris Begert wrote: Bonjour I have three lists with 65 float items and would like to do the following sum: L0 = ([sum(L0A[i]*cos(L0B[i]+L0C[i]*JME) for i in range(0,64,1))]) So it just should do a sum across all the items in the list: L0A[0]*cos(L0B[0]+L0C[0]*JME)+

Re: [Tutor] Weighted Random Choice - Anyone have an efficient algorithm?

2010-12-23 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Modulok wrote: Does anyone know of an efficient way of doing a weighted random choice? (I don't even know what algorithms like this would be called.) Preferably, something that doesn't grow exponentially with the number of elements in the list, or the size of their resp

Re: [Tutor] Weighted Random Choice - Anyone have an efficient algorithm?

2010-12-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Albert-Jan Roskam wrote: Hi Steven, Doesn't this qualify as 'monkeying with the loop index'? [*] import random weights = [5, 20, 75] counts = {0:0, 1:0, 2:0} for i in xrange(100): ... i = weighted_choice(weights) #<--- monkeying right here (?) ... counts

Re: [Tutor] A class list

2010-12-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Robert Berman wrote: I am working on the second part of the 'Bingo' problem defined at the Bingo Praxis web page, http://programmingpraxis.com/2009/02/19/bingo/. My notes as how to best define and build the problem: 'In a large game with five hundred cards in play, wh

Re: [Tutor] scraping and saving in file

2010-12-29 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Tommy Kaas wrote: Steven D'Aprano wrote: But in your case, the best way is not to use print at all. You are writing to a file -- write to the file directly, don't mess about with print. Untested: f = open('tabeltest.txt', 'w') url = 'http://www.kaasogmulvad.dk/unv/

Re: [Tutor] Print Help

2010-12-29 Thread Dave Angel
On 01/-10/-28163 02:59 PM, delegb...@dudupay.com wrote: #§¶Ú%¢Šh½êÚ–+-jwm…éé®)í¢ëZ¢w¬µ«^™éí¶­qªë‰ë–[az+^šÈ§¶¥ŠË^×Ÿrœ’)à­ë)¢{°*'½êí²ËkŠx,¶­–Š$–)`·...@Ý"žÚ Not sure why the quoting of this particular message didn't work. Since I have no problem with anyone else's message, I suggest i

Re: [Tutor] How does it work?

2011-01-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Patty wrote: for c in 'abcd': .. When I first looked at this - I thought that the variable 'c' would have had to be initialized first earlier in the program. And I thought that the programmer would input a single char or a single space. I wasn't thinking counti

Re: [Tutor] regex question

2011-01-04 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Richard D. Moores wrote: On Tue, Jan 4, 2011 at 11:57, Richard D. Moores wrote: On Tue, Jan 4, 2011 at 10:41, Richard D. Moores wrote: Please see http://tutoree7.pastebin.com/z9YeSYRw . I'm actually searching RTF files, not TXT files. I want to modify this script t

Re: [Tutor] range function and floats?

2011-01-05 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Wayne Werner wrote: On Wed, Jan 5, 2011 at 10:43 AM, Steven D'Apranowrote: Wayne Werner wrote: The decimal module allows you to get rid of those pesky floating point errors. See http://docs.python.org/library/decimal.html for more info. That's a myth. Decimal s

Re: [Tutor] Open a text file, read and print pattern matching

2011-01-09 Thread Dave Angel
(Don't top-post. You keep putting your responses out of order.) On 01/-10/-28163 02:59 PM, tee chwee liong wrote: i modified the code to be: fname = "sampledata.txt" pattern = "-1" failed = False for line in open(fname): data=line.split() if len(data)==4: port, channel, lane

Re: [Tutor] how come this doesnt work

2011-01-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, walter weston wrote: I generate a random number(supposedly a password, in my case its just a long floating point lol),I want the user to reinput that number and I want to print a string if the number entered is correct. so if m==num(num is the number generated and m

Re: [Tutor] defining functions and classes

2011-01-15 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Brett Murch wrote: Hi everyone, I'm just starting to learn Python and am starting by creating a text game but am having trouble with classes and funtions. I want to create a class or function where someone creates a charater and has a choice of their name or os. This i

Re: [Tutor] Why super does not work !

2011-01-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Karim wrote: Hello, I implemented Observer DP on a listbox (Tkinter) as follows and I don't understand why super() is not working and Observable.__init__(self) is working, cf below: class ListObservable(Listbox, Observable): """Creation de widget Listbox""" def __in

Re: [Tutor] Problems passing a parameter in a GUI

2011-01-18 Thread Dave Angel
On 01/-10/-28163 02:59 PM, David Holland wrote: Hi All, I hope this makes sense I am trying to write a GUI where you click on a button and each time you click on the button it shows in the entry text how many times you have clicked. However when I changed an earlier version of the code to pass

Re: [Tutor] ascii codec cannot encode character

2011-01-28 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Alex Hall wrote: Hello again: I have never seen this message before. I am pulling xml from a site's api and printing it, testing the wrapper I am writing for the api. I have never seen this error until just now, in the twelfth result of my search: UnicodeEncodeError: 'A

Re: [Tutor] ascii codec cannot encode character

2011-01-28 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Alex Hall wrote: I tried both of those and got a different error. I have since fixed it so I no longer have the exact text, but it was something about not supporting convertion from unicode. I finally ended up doing this: self.title�ta.find("title").text.encode("utf-8"

Re: [Tutor] ascii codec cannot encode character

2011-01-28 Thread Dave Angel
On 01/28/2011 08:02 AM, Alex Hall wrote: On 1/28/11, Dave Angel wrote: On 01/-10/-28163 02:59 PM, Alex Hall wrote: I tried both of those and got a different error. I have since fixed it so I no longer have the exact text, but it was something about not supporting convertion from unicode. I

Re: [Tutor] Wrapping my head around global variables!!

2011-01-28 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Nevins Duret wrote: Hello Python collective, I am trying to wrap my head around what exactly is causing me not to get any output or error message in the following code: #!/usr/bin/env python3.1 import random def main(): def chosen_letter(): chosen_letter = Conson

Re: [Tutor] pywin32 help

2011-01-30 Thread Dave Angel
(please don't top-post. Insert the ">" symbol in front of whatever lines you're quoting, and put your response under the quote. Most email programs can be configured to do this easily, or even automatically.) On 01/-10/-28163 02:59 PM, Elwin Estle wrote: I'm not 100% sure, but I think the Ac

Re: [Tutor] RE module is working ?

2011-02-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: (snip> *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (appears as stars) but I don't know how to fix

Re: [Tutor] process and modify a list of strings, in place

2011-02-10 Thread Dave Angel
On 01/-10/-28163 02:59 PM, John Martinetti wrote: Hello - Welcome, # - create a record from all the fields linedata = (vendornum, vendorname, ordernum, ordersuffix, orderdate, buyer, partnum, qty, comment) # - append the record to the list of records representing the CQ report

Re: [Tutor] Python + Sound

2011-02-12 Thread Dave Angel
On 01/-10/-28163 02:59 PM, David Hutto wrote: On Sat, Feb 12, 2011 at 4:43 AM, Alan Gauld wrote: "David Hutto" wrote and what is sound, electromagnetically transmitted, then turned into ones and zeroes. Just to be picky sound is mechanical waves not electromagnetic. The ear is primarily a

Re: [Tutor] How to group data?

2011-02-13 Thread Dave Angel
On 01/-10/-28163 02:59 PM, tee chwee liong wrote: hi, i'm using Python 2.5 and Win XP. i want to extract the last column of the attached text file and group 128 characters to each row. want the result to look like: Row1=X.1XXX (total of 128 char) Row2=11XX.

Re: [Tutor] How to group data?

2011-02-13 Thread Dave Angel
On 02/13/2011 07:03 PM, tee chwee liong wrote: How about some clues as to what you're trying to accomplish? This code is surprisingly verbose, and probably totally wrong. Anyway, each time you pop an item from the list, all the following ones change their index. So presumably there weren't stil

Re: [Tutor] Concatenating string

2011-02-22 Thread Dave Angel
On 01/-10/-28163 02:59 PM, tee chwee liong wrote: hi Francesco, couldnt get hex of bin working on IDLE Python 2.5 when i type: hex(0b1001001001001001001) SyntaxError: invalid syntax bin(0x49249) Traceback (most recent call last): File "", line 1, in bin(0x49249) NameError: name 'bi

Re: [Tutor] comparing strings

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Edward Martinez wrote: On 02/23/11 19:29, Corey Richardson wrote: On 02/23/2011 10:22 PM, Edward Martinez wrote: Hi, I'm new to the list and programming. i have a question, why when i evaluate strings ie 'a'> '3' it reports true, how does python come up with that? W

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, pyhx0r wrote: Dear All, multiple = 1024 if a_kilobyte_is_1024_bytes else 1000 for suffix in SUFFIXES[multiple]: size /= multiple if size< multiple: return '{0:.1f} {1}'.format(size, suffix) I’ve shorted the code be:

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Dave Angel
On 02/24/2011 11:55 AM, Walter Prins wrote: On 24 February 2011 16:22, Dave Angel wrote: (Is there a reason you double-spaced all that code? It makes it very hard to read, and quite difficult to quote, since I had to delete every other line.) For what it's worth the code cam

Re: [Tutor] Running Existing Python

2011-02-26 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Justin Bonnell wrote: Okay. When I try to run the script from the terminal, it still doesn't work. Here is a screenshot. What am I doing wrong? 1) You're top-posting. Put your responses after the quote you're responding to. 2) You're trying to include graphic

Re: [Tutor] accessing another system's environment

2011-02-26 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Steve Willoughby wrote: On 26-Feb-11 01:19, ALAN GAULD wrote: Bill, That's the same thing we are talking about. The problem is those environment variables are highly variable so you can't talk about a machine's environment. Two users on the same machine (at the same t

Re: [Tutor] Running Existing Python

2011-02-26 Thread Dave Angel
On 02/26/2011 04:10 PM, Justin Bonnell wrote: On Feb 26, 2011, at 4:49 AM, Dave Angel wrote: On 01/-10/-28163 02:59 PM, Justin Bonnell wrote: Okay. When I try to run the script from the terminal, it still doesn't work. Here is a screenshot. What am I doing wrong? 1) You&#

Re: [Tutor] Running Existing Python

2011-02-27 Thread Dave Angel
On 02/27/2011 02:50 AM, Justin Bonnell wrote: On Feb 26, 2011, at 10:51 PM, Dave Angel wrote: On 02/26/2011 06:03 PM, Justin Bonnell wrote: On Feb 26, 2011, at 4:05 PM, Dave Angel wrote: As for cd not working, someone else has pointed out that in the shell, you need to escape

Re: [Tutor] very odd math problem

2011-03-11 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Alan Gauld wrote: "Steven D'Aprano" wrote The right way is to do it like this: >>> x = 0.0 >>> for i in range(1, 11): ... x = i*0.1 ... >>> x == 1.0 True But this I don't understand. Why would you use a loop when the final value is just the final multiplicati

Re: [Tutor] very odd math problem

2011-03-11 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Steven D'Aprano wrote: Alan Gauld wrote: Why would you use a loop when the final value is just the final multiplication. Since you know the final value in advance (you need it to create the loop!) why not just do the final multiplication directly: x = 10*0.1 I think

Re: [Tutor] binary, ascii, steganography

2011-03-18 Thread Dave Angel
On 01/-10/-28163 02:59 PM, jaco erasmus wrote: Hi there, list The other day I got bored at work and decided to give this programming thing a try, since Rick Romero said it's becoming all the rage these days. Eventually, I want to end up writing a steganography program, but for now I am still an i

Re: [Tutor] Need some clarification on this

2011-03-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Joel Goldstick wrote: 2011/3/19 Yaşar Arabacı a=5 b=5 a == b True a is b True My question is, why "a is b" is true. What I expected it to be is that, a and b are different things with same value. ___ Tutor maillist -

Re: [Tutor] lambda

2011-03-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Ajit Deshpande wrote: I am trying to figure out where lambda functions can be useful. Has anyone used them in real world? From my reading so far, I hear people claim that lambda can be a useful replacement for small functions. Most examples didn't make much sense to

Re: [Tutor] a function I fail to understand

2011-03-21 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Alex Hall wrote: On 3/21/11, David wrote: Hello list, I am having trouble understanding the following function. What trips me up is the "letter = letter.lower()" line. As I understand, the function takes a letter and assigns True to a letter if it is upper case. No

Re: [Tutor] Recursively flatten the list

2011-03-26 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Prasad, Ramit wrote:" >A more important problem is that it is flattening only one level. >Multi-level flattening is I think not possible without using some kind >of recursion." > >Not true, just requires more iterations to check each element. Each >iteration could chec

Re: [Tutor] Python closes out on attempt to run script

2011-03-26 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Matthew Speltz wrote: I'm trying to teach myself python and have run across a rather annoying error. I'm not sure exactly where the fault lies, so please pardon me for posting too much information, I'm not sure what would be relevant. I'm running the Python 3.2 Window

Re: [Tutor] Need help with the property function

2011-04-13 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Jim Byrnes wrote: I'm trying to teach myself OOP in python (again). The following code from Dawson's book runs fine, unaltered [1]. class Critter(object): """ A virtual pet """ def __init__(self, name): print "A new critter is born" self.name = name def get_name(self)

Re: [Tutor] data validation logic

2011-04-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Rance Hall wrote: Hey gang: I need some help trying to pythonize (sp?, if this is even a word?) an idea. I'd like to define a datavalidation function that returns true if data is valid, and false if it isn't. I need a way to store the pass fail values of each of th

Re: [Tutor] NameError?

2011-04-27 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Brad Desautels wrote: Hello, I am working on a problem for my computer science class. This program is supposed to change the expression of the face when the appropriate button is clicked. It seems logical that it should work, however, when I click one of the buttons, I

Re: [Tutor] Help with sys.argv

2011-04-29 Thread Dave Angel
On 01/-10/-28163 02:59 PM, monkey...@aim.com wrote: Hello, I am trying to learn how to use python with Facebook's Open Graph API. I am getting my feet wet with the following code authored by Matthew A. Russell. I copied it line for line for learning purposes, but I am getting the following

Re: [Tutor] Dictionary File character reader

2011-05-10 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Clara Mintz wrote: Sorry I am completely new at python and don't understand why this function is returning an empty dictionary. I want it to take a list of files open them then return the number of characters as the value and the file name as the key. def fileLengths

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Dave Angel
On 01/-10/-28163 02:59 PM, tax botsis wrote: I have the following txt file that has 4 fields that are tab separated: the first is the id and the other three show the results per test. 152 TEST1 valid TEST3 good TEST2 bad 158 TEST2 bad TEST1 bad TEST4 valid . . . Based on the above txt I need to

Re: [Tutor] can I walk or glob a website?

2011-05-18 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Alan Gauld wrote: "Albert-Jan Roskam" wrote How can I walk (as in os.walk) or glob a website? I don't think there is a way to do that via the web. Of course if you have access to the web servers filesystem you can use os.walk to do it as for any other filesystem, b

Re: [Tutor] Sequencing

2011-05-18 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Cindy Lee wrote: Hi Pyton Tutors thanks for adding me, I am new to Python and missed one of my classes and am not sure of my homework. We are currently on sequencing and are being asked to make a function that receives text as an argument and returns the same text, b

Re: [Tutor] Structured files?

2011-06-02 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Válas Péter wrote: 2011. június 2. 9:29 Simon Yan írta,: Yes you can. I guess the question is how you want the information to be structured. IMHO, everything in Python can be "string-lized". What is the syntax then? I have Windows XP. The code is: f=open("xxx.dat",

Re: [Tutor] Copying a mutable

2011-06-07 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Válas Péter wrote: Hi, let X be a mutable container, such as dict/set/list=bytearray, and Y=X, When I change X, Y will follow it, having always the same value, although id(X)!=id(Y). How is that, what is the explanation? Meanwhile the same for immutable types results a

Re: [Tutor] Python Beginners

2011-06-08 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Vincent Balmori wrote: Hello. Right now I am learning the python language through Python Programming for the Absolute Beginner 3rd Edition. I am having trouble with one question in Ch. 4 #3, which says "Improve 'WordJumble so that each word is paired with a hint. The pl

Re: [Tutor] using configobj package to output quoted strings

2011-06-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Alex Hall wrote: On 6/18/11, Steven D'Aprano wrote: Alex Hall wrote: Hello all, I am using the configobj package to handle a ridiculously simple ini What's configobj? >>> import configobj Traceback (most recent call last): File "", line 1, in ImportError: N

Re: [Tutor] BF Program hangs

2011-06-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Kaustubh Pratap chand wrote: > Hello i made this program which interprets brainf*** > > But i don't understand why it doesn't endsand also it doesn't print anything > > import sys > > cell=[0] * 3 > code_pointer=0 > cell_pointer=0 > close_brace_pos=

Re: [Tutor] Blackjackbetting

2011-07-04 Thread Dave Angel
# remove everyone's cards for player in self.players: player.clear() self.dealer.clear() def main(): print("\t\tWelcome to Blackjack!\n") stash = 0 wager = 0 names = [] number = games.ask_number("How many players? (1 - 7)

Re: [Tutor] compare and arrange file

2011-07-11 Thread Dave Angel
On 07/11/2011 06:39 PM, Emile van Sebille wrote: On 7/11/2011 3:16 PM Edgar Almonte said... hello , i have a file this a structure like this X | 0.00| 88115.39| X | 90453.29| 0.00| X | 0.00| 90443.29|

Re: [Tutor] compare and arrange file

2011-07-12 Thread Dave Angel
On 07/12/2011 12:56 AM, Edgar Almonte wrote: thanks emile i understand exactly what you explain me but i was unable to accomplish it ( too noob in python ) but i solved the problem with this code http://pastebin.com/4A6Jz4wZ (When you post on this list, your comments should follow the pieces yo

Re: [Tutor] compare and arrange file

2011-07-12 Thread Dave Angel
On 07/12/2011 08:25 AM, Edgar Almonte wrote: On Tue, Jul 12, 2011 at 7:28 AM, Dave Angel wrote: On 07/12/2011 12:56 AM, Edgar Almonte wrote: thanks emile i understand exactly what you explain me but i was unable to accomplish it ( too noob in python ) but i solved the problem with this code

Re: [Tutor] Descriptors and type declaration order

2011-07-14 Thread Dave Angel
On 07/14/2011 05:44 AM, Knacktus wrote: Hi guys, I've got the following (not working) code: class Attribute(object): def __init__(self, attribute_name, att_type_name): self._attribute_name = attribute_name try: self._attribute_type = globals()[att_type_name]

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Dave Angel
On 07/15/2011 07:39 PM, Richard D. Moores wrote: On Fri, Jul 15, 2011 at 16:21, xDog Walker wrote: I believe on Windows, you can almost always use a forward slash in a path: C:/somewhere/somewhereelse/ with open("C:/test/test.txt", "a") as file_object: print("Hello, world!", file=file_o

Re: [Tutor] what is 'doubleword alignment'?

2011-07-16 Thread Dave Angel
--- On Sat, 7/16/11, Albert-Jan Roskam wrote: From: Albert-Jan Roskam Subject: [Tutor] what is 'doubleword alignment'? To: "Python Mailing List" Date: Saturday, July 16, 2011, 8:23 PM Hello, What is 'doubleword alignment'? It is used in the following sentence: "Fill up the buffer with the c

Re: [Tutor] Program to Predict Chemical Properties and Reactions

2011-07-16 Thread Dave Angel
On 07/16/2011 05:32 PM, B G wrote: Thanks, Emile-- although I'm not sure I was completely clear about my objective. What I really meant is that is there a way (via machine learning) to give the computer a list of rules and exceptions, and then have it predict based on these rules the ionization e

Re: [Tutor] Program to Predict Chemical Properties and Reactions

2011-07-16 Thread Dave Angel
On 07/16/2011 07:21 PM, Christopher King wrote: Actually maybe not, depending on the complexity of the pattern, but it would be difficult. You would have to know how much it decreases for every time you go down or to the right. If its more complex than that, you may have to program each rule in,

Re: [Tutor] little/big endian was Re: what is 'doubleword alignment'?

2011-07-20 Thread Dave Angel
On 07/19/2011 05:43 PM, Alan Gauld wrote: Albert-Jan Roskam wrote: > and ctypes to process the data in python. It works now, although I > still want to read more about this. Where does the distinction > little/big endian enter this story? That's to do with which bit in a byte/word is most signif

Re: [Tutor] Removing characters in a string using format()

2011-07-21 Thread Dave Angel
On 07/21/2011 01:53 PM, Ryan Porter wrote: Hi there, In one part of a program I'm writing, I want a list to be printed to the string. Here's my code: # Begin snippet listString = input('Please enter a single item: >').strip(); /print(); itemList.append(listString); / /... /

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-22 Thread Dave Angel
On 07/22/2011 06:40 PM, dave wrote: Hello, I'm trying to work on GNU Radio and having trouble understanding some of the Python code. I have a C/C++ coding background. I'm looking at the ieee802.15.4 code found on CGRAN. It's about 4 years old and runs but doesn't fun

Re: [Tutor] how to temporarily disable a function

2011-07-28 Thread Dave Angel
On 07/27/2011 09:58 PM, Pete O'Connell wrote: Hi I was wondering if there is a way to disable a function. Hi have a GUI grid snapping function that I use in a program called Nuke (the film compositing software) Here is the function (which loads when Nuke loads): ### def theAu

Re: [Tutor] Sorting lists both ways at once and programmatically loading a variable.

2011-07-28 Thread Dave Angel
On 07/28/2011 07:05 PM, Prasad, Ramit wrote: I have 2 questions. 1. Is there a way to do a reverse and a normal sort at the same time? I have a list of tuples (there are more than 2 elements in the tuples but I only want to sort by the first two). I want to sort in reverse for the first elemen

Re: [Tutor] Mainloop conflict

2011-07-28 Thread Dave Angel
On 07/28/2011 08:32 PM, Christopher King wrote: Dear Tutor Dudes, I have a socket Gui program. The only problem is that socket.recv waits for a response, which totally screws Tkinter I think. I tried making the timeout extremely small (it was alright if I didn't receive anything, I was excep

Re: [Tutor] Running files from command prompt

2011-07-28 Thread Dave Angel
On 07/28/2011 09:58 PM, Alexander Quest wrote: I downloaded the google's python exercise files from their website ( http://code.google.com/edu/languages/google-python-class/set-up.html), unzipped them, and placed them in C. I then added the following to the PATH variable under system settings so

Re: [Tutor] Mainloop conflict

2011-07-29 Thread Dave Angel
y, July 28, 2011, Dave Angel wrote: On 07/28/2011 08:32 PM, Christopher King wrote: Dear Tutor Dudes, I have a socket Gui program. The only problem is that socket.recv waits for a response, which totally screws Tkinter I think. I tried making the timeout extremely small (it was alright i

Re: [Tutor] Mailing list documentation

2011-07-31 Thread Dave Angel
On 07/31/2011 08:42 PM, Christopher King wrote: Wow wow, way is a ser...@might.co.za person doing a tutor response. And why can I see it if it isn't to me.. I'm sorry Sergey if this isn't something malicious, it just seems suspicious. (You could try reading it, instead of just getting suspicious

<    3   4   5   6   7   8   9   10   11   12   >