Re: regex: multiple matching for one string

2009-07-23 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Agreed. Two string.split()s, first at the semi-colon and then at the equal sign, will yield you your value, without having to fool around with regexes. On 7/23/2009 9:23 AM, Mark Lawrence wrote: scriptlear...@gmail.com wrote: For example, I have a

Re: Total No. of Records in a File?

2008-08-23 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Err...you want to know what is in a file before you open it? This could be done if you keep some external database documenting changes made to the file. But unless I misunderstand what you're saying, then it's not possible to know the contents of a

Re: how many nested for can we utilize?

2008-08-17 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 A good quote I read (I can't remember who it was from, though) is If you need more than three levels of indentation, then something is seriously wrong with your code. Possibly Guido himself? Anyway. If you've got 100 levels of for, you're probably

Re: proposal, change self. to .

2008-08-03 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It's also worth noting that you can use a different name for the object that represents your class. If you did def __init__(foo):pass, then you would be able to access the class's objects with foo.objectname. Using self is simply the recommended

Re: import dll instead of pyd

2008-07-24 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is this DLL in the same directory as your script? If not, is it part of your pythonpath? If neither are true, then you won't be able to import it, regardless of whether it's a good file or not. jrh wrote: Hello, From previous posts and

Re: a question that can accelerate learning python?

2008-07-20 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Simple. dir(object) [EMAIL PROTECTED] wrote: I am new to python .But interest in it . I think if python could provide a method that show every method of an object or an module.it will be great! We can save a lot of time to find the document take

Re: Regular expression help

2008-07-18 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think you're over-complicating this. I'm assuming that you're going to do a line graph of some sorta, and each new line of the file contains a new set of data. The problem you mentioned with your regex returning a match object rather than a string

Re: Suggestion: Python global scope

2008-07-15 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The function of the global keyword is to 'push' local variables to the global scope. If you want to 'import' a variable into a local scope, pass the variable to your function/method as an argument. Anonymous Bastard wrote: I've been tossing this

Re: Newbie Threading Question

2008-07-13 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm not an expert on Python threading, so don't take my word as low, however, I believe that there's no need for a list of systems which support it because the Python virtual machine handles it. Thus, any system which supports Python (or at least

Re: Smal question

2008-07-10 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This is easy. Simply create a .py file containing all the methods you want to share. Put this file in the same directory as the rest of your project files. In each of your project files that requires one of the methods, simply import name of method

Re: inconsistency?

2008-07-07 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [1,2] in [1,2,3] checks to see if the list [1,2] is an item in [1,2,3]. Because the list [1,2,3] only contains the integers 1,2,3, the code returns a False. Try [1,2] in [[1,2],[2,3]] David C. Ullrich wrote: Luckily I tried it before saying no,

Re: windows installers and license agreement

2008-06-29 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Darren Dale wrote: Is it possible to create a windows installer using distutils that includes a prompt for the user to agree to the terms of the license? Thanks, Darren Yeah. In your setup.py script, have it pop up a console window with the

Pygame and Tkinter

2008-06-28 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm doing a project with Pygame, a Snake game, and I've just taken a look at Tkinter and I really like how easy it is to build a GUI with it. The thing is that I don't know how I would use Tkinter and Pygame in conjunction. They seem to have some

Re: Do I need self and other?

2008-06-28 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter Pearson wrote: On Fri, 27 Jun 2008 20:19:00 -0400, Nick Dumas [EMAIL PROTECTED] wrote: [snip] Example: class Foo(): self.x = 5 Have you tried what you're posting? Python 2.4.3 (#2, Oct 6 2006, 07:52:30) [GCC 4.0.3 (Ubuntu

Re: Do I need self and other?

2008-06-27 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kurda Yon wrote: Hi, I found one example which defines the addition of two vectors as a method of a class. It looks like that: class Vector: def __add__(self, other): data = [] for j in range(len(self.data)):

Re: C++ or Python

2008-06-27 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kurda Yon wrote: I would like to know what are advantages of Python in comparison with C ++? In which cases and why Python can be a better tool than C++? Thank you! I'm a relative novice, so I couldn't tell you about deeply hidden features or

Re: Pygame, how to show window without loop? no loop=popupand close...

2008-06-27 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 defn noob wrote: Im using PyGame to draw images of graphs and trees. Howver right now i am looping using: while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() screen.fill(screencolor)