Re: [Tutor] implied tuple in a list comprehension

2013-08-02 Thread Hugo Arts
On Fri, Aug 2, 2013 at 10:02 AM, Jim Mooney wrote: > On 2 August 2013 00:46, Alan Gauld wrote: > > On 02/08/13 08:32, Jim Mooney wrote: > > > How should Python interpret this? > > > > As > > > > x = [idx, (word for idx, word in S)] > > > > Or > > > > > > x = [(idx, word) for idx, word in S] > > >

Re: [Tutor] object size in python is in what units?

2013-07-23 Thread Hugo Arts
On Tue, Jul 23, 2013 at 9:09 AM, Jim Mooney wrote: > I've noticed that when I create a number of objects from a class, one > after another, they're at different IDs, but the IDs all appear to be > equidistant, so that they all appear to have the same size. But what does > that size represent? is i

Re: [Tutor] syntax error when attempting simple urllib.request.urlopen item

2013-07-10 Thread Hugo Arts
On Tue, Jul 9, 2013 at 10:00 PM, Paul Smith wrote: > Tutor- > > Ok newbie to coding here attempting to build controlled web scraper and > have followed several books-tutorials and am failing at step one. > > This is the 3.3.1 code I am trying to run.. > === > import urllib.request > > htmltext = u

Re: [Tutor] learning nested functions

2013-07-10 Thread Hugo Arts
On Mon, Jul 8, 2013 at 8:26 AM, Tim Hanson wrote: > In the first Lutz book, I am learning about nested functions. > > Here's the book's example demonstrating global scope: > >>> def f1(): > x=88 > def f2(): > print(x) > f2() > > > >>> f1() > 88 > > No prob

Re: [Tutor] Test Question

2013-07-01 Thread Hugo Arts
On Mon, Jul 1, 2013 at 1:01 PM, Dave Angel wrote: > On 07/01/2013 05:58 AM, John Steedman wrote: > >> >> I believe that "my_sequence" might be a either container class or a >> sequence type. An effective __hash__ function would be required for each >> "my_object". >> > > "in" doesn't care if ther

Re: [Tutor] Pi xels

2013-05-09 Thread Hugo Arts
On Thu, May 9, 2013 at 4:36 PM, Stafford Baines wrote: > Is there a way of controlling pixels on a graphics screen? I want to be > able to draw lines and curves. Is this possible with with Python? > > Stafford > There are various libraries available for drawing. Check these links, they might be u

Re: [Tutor] How did this decimal error pop up?

2013-04-16 Thread Hugo Arts
On Tue, Apr 16, 2013 at 7:43 PM, Jim Mooney wrote: > I was doing a simple training prog to figure change, and wanted to avoid > computer inaccuracy by using only two-decimal input and not using division > or mod where it would cause error. Yet, on a simple subtraction I got a > decimal error inste

Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Hugo Arts
On Tue, Mar 26, 2013 at 3:18 PM, Sean Carolan wrote: > > Could it be that it is taking the system python executable which is >> probably 2.4? >> >> -Amit. > > > I've tried it with python24, python25 and python27 and all of them give > the same error. > > What it looks like to me is that while yo

Re: [Tutor] Scripting Calligra sheets with Python

2013-03-18 Thread Hugo Arts
On Mon, Mar 18, 2013 at 5:18 PM, Jim Byrnes wrote: > I am trying to script Calligra Sheets (formerly KSpread) with python. I > have gotten some of the included example scripts to run so I know python > scripting is running. > > I found the following snippet on their website: > > import KSpread >

Re: [Tutor] func-question_y_n.py

2013-03-15 Thread Hugo Arts
On Fri, Mar 15, 2013 at 10:09 PM, Christopher Emery wrote: > > This code works and produces the results that I am looking for, > however I know there is a better way to do it and now you have me > thinking about this again. I just spent about 3 hours doing this > code. Yes! learning is happenin

Re: [Tutor] __init__ doesn't seem to be running

2013-03-15 Thread Hugo Arts
On Fri, Mar 15, 2013 at 10:25 PM, Cameron Macleod < cmacleod...@googlemail.com> wrote: > I added the "self." to both the references to tasks and then I added the > print statement to the __init__ function and I got the dreaded NameError of > death: > > > Traceback (most recent call last): > File

Re: [Tutor] __init__ doesn't seem to be running

2013-03-15 Thread Hugo Arts
On Fri, Mar 15, 2013 at 9:21 PM, Cameron Macleod wrote: > Hello everyone, I'm using Python 3.3 and am trying to write a simple to-do > list program. I have a class which runs pretty much everything called todo > and the __init__ method doesn't seem to be running. > > class todo(): > def __ini

Re: [Tutor] func-question_y_n.py

2013-03-15 Thread Hugo Arts
On Fri, Mar 15, 2013 at 9:01 PM, Christopher Emery wrote: > Hello All, > > Okay, I have created a small function that will check to see if a user > has answered with a Yes, No or other response. If the user puts yes > or no the function ends, if they put anything but yes or no then the > function

Re: [Tutor] Script to generate statements

2013-03-15 Thread Hugo Arts
On Fri, Mar 15, 2013 at 7:42 PM, Charles Leviton wrote: > I was recently given this task. it's a very IBM mainframe specific task > so I'm not sure how to find equivalent terms in another environment. I > will just use the mainframe terminology and hopefully y'all can figure out > what I mean. >

Re: [Tutor] Print to file

2013-03-11 Thread Hugo Arts
On Mon, Mar 11, 2013 at 10:38 AM, Phil wrote: > On 11/03/13 18:35, Hugo Arts wrote: > >> On Mon, Mar 11, 2013 at 9:24 AM, Phil > <mailto:phil_...@bigpond.com>> wrote: >> >> The usage of print to file is much like the Arduino print to serial >> d

Re: [Tutor] Print to file

2013-03-11 Thread Hugo Arts
On Mon, Mar 11, 2013 at 9:24 AM, Phil wrote: > The usage of print to file is much like the Arduino print to serial device > and it's got me curious to know what the correct syntax is. Neither of the > following is correct, but the second one seems closer to the mark. > > >>> print("test", file="/

Re: [Tutor] There's a Programmer in Me

2013-02-26 Thread Hugo Arts
On Tue, Feb 26, 2013 at 9:00 PM, Albert-Jan Roskam wrote: > > > The core developers are too busy to be hand-holding a newbie who > > doesn't know any Python, > > Well, in a way they *can*: I find it very inspiring to read the source > code of Python (the .py files), though I don't do this as ofte

Re: [Tutor] "Strange" behaviour of list comprehension

2013-02-13 Thread Hugo Arts
On Wed, Feb 13, 2013 at 10:07 PM, Mahadevan, Anand wrote: > Thanks for the good explanation, Hugo. Not sure of the protocol for > replying in this forum, when I clicked on reply it filled your id in. > Glad I could be of help :) For future reference, it's generally considered politest to send a

Re: [Tutor] "Strange" behaviour of list comprehension

2013-02-13 Thread Hugo Arts
On Wed, Feb 13, 2013 at 2:45 PM, Mahadevan, Anand wrote: > I'm playing around with list comprehension and in IDLE typed this in. I > actually wanted it to return all tuples satisfying the condition where z is > the sum of x and y. I kind of got mixed up with the syntax, hence I put a > comma in t

Re: [Tutor] recursive function password check

2013-02-06 Thread Hugo Arts
On Wed, Feb 6, 2013 at 1:44 PM, Mara Kelly wrote: > Hi everyone, trying to write a program that has the user enter a password, > checks if it contains any vowels, and if it does prints ' It is false that > password(whatever the user enters) has no vowels,' and if it has no vowels > prints it is T

Re: [Tutor] regarding the list problem

2013-02-06 Thread Hugo Arts
On Wed, Feb 6, 2013 at 9:48 AM, Kang, Yang Jae wrote: This line: > >>> a = [[0,0]]*3 > creates a list, a, which contains the list object [0, 0] three times. What's crucial to note is that it contains *the same object* three times, not three different objects with the same value. You can verify

Re: [Tutor] operator order

2013-01-31 Thread Hugo Arts
On Thu, Jan 31, 2013 at 8:20 PM, Danny Yoo wrote: > On Thu, Jan 31, 2013 at 11:36 AM, heathen > wrote: > > why is this: > > > d *= 3 + 4 > > > The gory details about how Python understands this expression can be found > in: > > > http://docs.python.org/3/reference/simple_stmts.html#augmente

Re: [Tutor] changing unicode to ascii

2013-01-30 Thread Hugo Arts
On Wed, Jan 30, 2013 at 2:39 PM, Benjamin Fishbein wrote: > I was trying to write text to a file and got the following error: > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in > position 5495: ordinal not in range(128) > > I tried several things I found online, such as: > > t

Re: [Tutor] Question regular expressions - the non-greedy pattern

2013-01-21 Thread Hugo Arts
On Mon, Jan 21, 2013 at 3:45 PM, Marcin Mleczko wrote: > Now I'm changing the input string to (adding an extra '<'): > > s = ' > and evoking the last command again: > > print re.match('<.*?>', s).group() > I would expect to get the same result > > > > as I'm using the non-greedy pattern.

Re: [Tutor] garbage collection/class question

2013-01-10 Thread Hugo Arts
On Thu, Jan 10, 2013 at 3:06 PM, richard kappler wrote: > Class is still something I struggle with. I think I'm finally starting to > get my head wrapped around it, but the discussion in a different thread has > sparked a question. First, please check my understanding: > A class creates objects, i

Re: [Tutor] Problem with calling class methods stored in a list

2013-01-10 Thread Hugo Arts
On Thu, Jan 10, 2013 at 11:13 AM, Tobias Marquardt wrote: > Hello, > > I have a class with some class methods that are also stored in a list. > Now I have a problem calling these methods. > Essentially the relevant code looks like this: > > class MyClass(object): > > @classmethod > def fo

Re: [Tutor] How to run multiline shell command within python

2013-01-10 Thread Hugo Arts
On Thu, Jan 10, 2013 at 7:01 AM, Karim wrote: > > > Hello all, > > I want to run multiline shell command within python without using a > command file but directly execute several lines of shell. > I already use *subprocess.checkoutput("csh -f my_file.csh".split())* but I > want to know if it is p

Re: [Tutor] stuck on a new program

2013-01-04 Thread Hugo Arts
On Fri, Jan 4, 2013 at 11:15 PM, Ghadir Ghasemi < ghasemm...@leedslearning.net> wrote: > Hi guys I recently created a binary to denary and denary to binary > convertor program. It is pretty much finished but I can't get it to work. > Can you spot the fault in it please and tell me how it coul be f

Re: [Tutor] Vending machine program

2013-01-04 Thread Hugo Arts
On Fri, Jan 4, 2013 at 12:34 PM, Ghadir Ghasemi < ghasemm...@leedslearning.net> wrote: > H I wanted to create a program called vending machine and I wondered if > you could do it so I can find out how to do it. > No. This list is meant to help people with specific questions about their python pro

Re: [Tutor] Trouble importing Paramiko

2013-01-02 Thread Hugo Arts
On Wed, Jan 2, 2013 at 10:48 AM, Ufuk Eskici wrote: > Hello Steven, > > I've written this before: > > "My Python version is 2.7.3 and it is installed in "C:\Python27 (on the > web, it says Paramiko-1.7.4 is supported with Python 2.7)" > > so I'm using the correct Python verion (2.7.3). But I dont

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Hugo Arts
On Thu, Dec 27, 2012 at 2:16 PM, Ufuk Eskici wrote: > This is the output, it fails. > > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] > on win32 > Type "copyright", "credits" or "license()" for more information. > >>> import paramiko > > Traceback (most recent call las

Re: [Tutor] how to control putty window

2012-12-27 Thread Hugo Arts
On Thu, Dec 27, 2012 at 10:53 AM, Ufuk Eskici wrote: > It seems it is looking for Paramiko under wrong folder. > > >>> import paramiko > > Traceback (most recent call last): > File "", line 1, in > import paramiko > File "C:/Users/eufuesk/Desktop\paramiko.py", line 3, in > ssh = par

Re: [Tutor] regex: matching unicode

2012-12-22 Thread Hugo Arts
On Sat, Dec 22, 2012 at 9:53 PM, Albert-Jan Roskam wrote: > Hi, > > Is the code below the only/shortest way to match unicode characters? I > would like to match whatever is defined as a character in the unicode > reference database. So letters in the broadest sense of the word, but not > digits,

Re: [Tutor] correct way to encode

2012-12-05 Thread Hugo Arts
On Wed, Dec 5, 2012 at 2:47 PM, Norman Khine wrote: > hello, i have this code from the google fusion table api: > > (zmgc)☺ python > * master 9e4be39 ✗zmgc" > Python 2.7.2 (default, Jan 28 2012, 14:53:22) > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin > Type "help", "copyrig

Re: [Tutor] CSV -> sqlite tables with foreign keys

2012-10-16 Thread Hugo Arts
On Wed, Oct 17, 2012 at 5:59 AM, Monte Milanuk wrote: > Hello, > > I'm working on a python script to take the sql script, create a sqlite3 > database, create the tables, and then populate them using the info from the > csv file. > The sticking point seems to be creating the foreign keys between t

Re: [Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Hugo Arts
On Tue, Sep 25, 2012 at 1:55 PM, Richard D. Moores wrote: > I was just perusing the Built-in Functions of Python 3.2 (< > http://docs.python.org/py3k/library/functions.html>) and was wondering > where would one ever use any() or all(). > > But so what? Could I get some better examples? > I freque

Re: [Tutor] Sudoku

2012-09-23 Thread Hugo Arts
On Sun, Sep 23, 2012 at 12:08 PM, myles broomes wrote: > > I'm currently coding a Sudoku clone but I'm having trouble displaying the > board: > > # Sudoku > # Sudoku is a logic-based number-placement puzzle > # The objective is to fill a 9×9 grid with digits so that each column, > each row, and ea

Re: [Tutor] Question about lists

2012-09-21 Thread Hugo Arts
On Fri, Sep 21, 2012 at 3:31 PM, Leo Degon wrote: > I'm trying to create a class where the main focus is creating a list whose > elements are lists and the elements of those lists are collection of zeros > and ones. I am trying to create functions to rotate the list ninety > degrees, to reflect i

Re: [Tutor] application whitelisting

2012-09-21 Thread Hugo Arts
On Fri, Sep 21, 2012 at 2:19 PM, Peter Otten <__pete...@web.de> wrote: > > Here's a back-of-the-envelope calculation: > > '4151e067c17a753fc5c4ec1c507d28c9' is a hexadecimal number with 32 digits, > otherwise known as > > 340282366920938463463374607431768211456L > > If you are trying to hit that nu

Re: [Tutor] How can I convert a variable name to a string?

2012-09-21 Thread Hugo Arts
On Fri, Sep 21, 2012 at 11:11 AM, Dae James wrote: > ** > How can I convert a variable name to a string ? > For example: > testVariable = 1000; > How can I get the string "testVariable" ? > Thank you~ > > Well, the locals() dictionary will have a "testVariable" entry in it.. but if I may ask, why

Re: [Tutor] Recursion always returns None

2012-08-28 Thread Hugo Arts
On Tue, Aug 28, 2012 at 1:23 PM, Dharmit Shah wrote: > Hello, > > I am trying to do the following : > > 1) Ask user for the length of the word that he'd like to guess (for > hangman game). > 2) Pick a random word from /usr/share/dict/words (which I understand > is not the best choice for hangman)

Re: [Tutor] Why begin a function name with an underscore

2012-08-28 Thread Hugo Arts
On Tue, Aug 28, 2012 at 11:13 AM, Richard D. Moores wrote: > On Tue, Aug 28, 2012 at 1:21 AM, Timo wrote: > > Op 28-08-12 10:06, Richard D. Moores schreef: > > >> What if I wanted 3., 1234., etc. to be considered ints, as they are by > >> _validate_int() ? > > > > > isinstance(3., (int, flo

Re: [Tutor] sneaky re.compile --is this a bug??

2012-08-16 Thread Hugo Arts
On Thu, Aug 16, 2012 at 11:23 AM, Walter Prins wrote: > Hi Albert, > > On 16 August 2012 09:45, Albert-Jan Roskam wrote: > > > > Hi, > > > > Is it intended behavior that regular expression flags are ignored when > > compiled regexes are used? In the code below, I intend to match path > names > >

Re: [Tutor] __new__ and __init__

2012-08-01 Thread Hugo Arts
On Wed, Aug 1, 2012 at 4:28 PM, rail shafigulin wrote: > Hello everyone. > > I'm trying to understand how to use the two methods. I know that __new__ > is used to create an object, while __init__ to initialize. But I'm not sure > what happens when I create an object. > > I found the following code

Re: [Tutor] finally without try or except

2012-07-31 Thread Hugo Arts
On Tue, Jul 31, 2012 at 5:23 PM, Prasad, Ramit wrote: > [snip] > > > >> This will be the most robust as it will > > >> also work for cases where the program is terminated without the use of > > >> the keyboard (i.e. kill -9, task manager, computer reboot, etc.) but > > > > That unfortunately is n

Re: [Tutor] Regular expressions: findall vs search

2012-07-10 Thread Hugo Arts
On Tue, Jul 10, 2012 at 9:26 PM, Alexander Q. wrote: > I'm a bit confused about extracting data using re.search or re.findall. > > Say I have the following code: tuples = > re.findall(r'blahblah(\d+)yattayattayatta(\w+)moreblahblahblah(\w+)over', > text) > > So I'm looking for that string in 'tex

Re: [Tutor] updating step size while in loop

2012-07-09 Thread Hugo Arts
On Mon, Jul 9, 2012 at 11:59 PM, Abhishek Pratap wrote: > hey guys > > I want to know whether it is possible for dynamically update the step > size in xrange or someother slick way. > > Here is what I am trying to do, if during a loop I find the x in list > I want to skip next #n iterations. > >

Re: [Tutor] Mapping ID's for corresponding values in different Columns

2012-07-09 Thread Hugo Arts
On Sun, Jul 8, 2012 at 11:47 PM, Fred G wrote: > Hi-- > > My current input looks like the following: > > FILE1.csv > PERSON_IDPERSON_NAME > 1 Jen > 2 Mike > 3 Jim > 4 > 5 Jane > 6 Joe > 7

Re: [Tutor] Reading a csv of coordinates, trying to write a csv of bearings.

2012-07-09 Thread Hugo Arts
On Mon, Jul 9, 2012 at 3:10 AM, Gregory Lund wrote: > I'm Not looking for an absolute solution, but perhaps some insight > into some snippets of code, or > suggestions of where I should seek out answers to this issue. > Or where I've gone wrong below. > NOTE: currently this 'code' below r

Re: [Tutor] using dynamic import statements

2012-07-09 Thread Hugo Arts
On Mon, Jul 9, 2012 at 3:10 AM, Chris Hare wrote: > > Here is what I want to do: > > I have a bunch of modules to import. instead of duplicating a lot of code > for each import, I want to do something like this: > > importList = [ "sys", "os", "imp", "stat", "re", "webbrowser", "Image", > "Strin

Re: [Tutor] for loop question

2012-07-04 Thread Hugo Arts
On Sun, Jul 1, 2012 at 11:50 PM, Jim wrote: > Hello Friends, > I apologize for being such a bother. This problem has been evading me all > day. Can you please give me a hint as to why I cannot put the variable > UpperCaseSentence outside of the for loop? > I can do it in other instances but not i

Re: [Tutor] Generating random alphanumeric codes

2012-06-26 Thread Hugo Arts
On Tue, Jun 26, 2012 at 4:52 PM, Sithembewena Lloyd Dube wrote: > HI, > > Would anyone have tips on how to generate random 4-digit alphanumeric > codes in python? Also, how does one calculate the number of possible > combinations? > > Thanks in advance. > > Python's, random module is your friend.

Re: [Tutor] FW: null inputs

2012-03-15 Thread Hugo Arts
On Thu, Mar 15, 2012 at 3:56 PM, James Reynolds wrote: > > > You can't prevent users from entering whatever they feel like it, but you > can prevent your program from processing that input and force them to try > again. > > The typical way this is done is through a while loop: > > age = '' > > whi

Re: [Tutor] seeing the results of a python program in windows7

2012-03-14 Thread Hugo Arts
On Wed, Mar 14, 2012 at 5:12 PM, Tamar Osher wrote: > Hi.  I ask for help.  Thanks very much for your time. > > I can run a python program in Notepad++, but what happens is that the black > box flashes and disappears immediately, so that I never see the results. >  How can I style it so that the r

Re: [Tutor] Position issue with Pygame

2012-03-13 Thread Hugo Arts
On Tue, Mar 13, 2012 at 6:00 PM, Greg Nielsen wrote: > Hey everyone, > > Still working on that racing game project. I have come quite a far way > and will hopefully release something soon, but I wrote some bad code and > can't seem to fix it. Im most likely just missing something really silly

Re: [Tutor] How to hide cursor in Terminal?

2012-02-17 Thread Hugo Arts
On Fri, Feb 17, 2012 at 12:38 PM, brandon w wrote: > I made a timer that counts down from five minutes. This code runs fine but I > a seeing a cursor blinking on the first number as the code is running. How > do I avoid this? > > I am using gnome-terminal and Python 2.6.6. > > > #!/usr/bin/python

Re: [Tutor] Class definition confusion

2012-02-15 Thread Hugo Arts
On Wed, Feb 15, 2012 at 7:14 PM, Sivaram Neelakantan wrote: > > I was under the impression that you have to define the attributes of > the class before using it in an instance.  Following the book > 'thinking in Python', > class Point: > ...     """pts in 2d space""" > ... print Point >

Re: [Tutor] tabbed output

2012-02-12 Thread Hugo Arts
On Mon, Feb 13, 2012 at 1:52 AM, Michael Lewis wrote: > I am having a weird issue. I have a print statement that will give me > multiple outputs separated by a tab; however, sometimes there is a tab > between the output and sometimes there is not. It seems sort of sporadic. My > code is below and

Re: [Tutor] string integers?

2012-02-12 Thread Hugo Arts
On Sun, Feb 12, 2012 at 2:25 PM, William Stewart wrote: > I am trying to get 2 string variables and 2 integer variables to be able > to be multiplied > can anyone tell me what I did wrong > > str1 = raw_input("Type in a String: ") > str2 = raw_input("Type in a String: ") > int1 = raw_input("Type

Re: [Tutor] Concatenating multiple lines into one

2012-02-10 Thread Hugo Arts
On Fri, Feb 10, 2012 at 5:38 PM, Spyros Charonis wrote: > Dear python community, > > I have a file where I store sequences that each have a header. The structure > of the file is as such: > >>sp|(some code) =>1st header > AGGCGG > MNKPLOI > . > . > >>sp|(some code) => 2nd header >

Re: [Tutor] Question about an example in Python doc

2012-02-10 Thread Hugo Arts
On Fri, Feb 10, 2012 at 3:12 PM, daedae11 wrote: > The example is the third example in (Python2.7's doc)->(Python Library > Reference)->17.2.2. > The code of the example is: > > import socket > > # the public network interface > HOST = socket.gethostbyname(socket.gethostname()) > > # create a raw 

Re: [Tutor] (no subject)

2012-02-07 Thread Hugo Arts
On Tue, Feb 7, 2012 at 7:50 PM, Debashish Saha wrote: > for i in range(1, 8): >    print(i) >    if i==3: >        break > else: >    print('The for loop is over') > > >  Output: > 1 > 2 > 3 > > Question:but after breaking the for loop why the else command could not work? > because the else state

Re: [Tutor] Deleting an object

2012-01-29 Thread Hugo Arts
On Sun, Jan 29, 2012 at 4:14 PM, George Nyoro wrote: > Hi all, > >    Last time I tried to post a question regarding this, I was asked to > clarify. Okay so here it is. There is a class called Table and objects are > just tables, you know, matrices, holding different types of data. Thing is, >

Re: [Tutor] checking return status of 'ping' in windows

2012-01-21 Thread Hugo Arts
On Sat, Jan 21, 2012 at 7:47 PM, Nikunj Badjatya wrote: > Hi All, > > I am using the following snippet to check the availability of an IP address. > If that IP addr is found free than it can be used later on for further > operations. > Python ver 3.2 > Windows OS > > {{{ > pingret = subprocess.Pop

Re: [Tutor] Continuous Shooting

2012-01-12 Thread Hugo Arts
On Thu, Jan 12, 2012 at 1:39 PM, ANKUR AGGARWAL wrote: > Hey > I was making a demo shooting game and problem is that I want > a continuous stream of bullets. As of now on pressing the space key only one > bullet comes out of the plane (I want this to be continuous stream). On > pressing space key

Re: [Tutor] Defining a File path

2012-01-11 Thread Hugo Arts
On Tue, Jan 10, 2012 at 11:24 PM, Dave Angel wrote: > On 01/10/2012 04:53 PM, Hugo Arts wrote: >> >> On Tue, Jan 10, 2012 at 8:31 PM, Adrian  wrote: >>> >>> Hi guys, >>> I know that if i dont include any path information, python looks in the >>>

Re: [Tutor] Defining a File path

2012-01-10 Thread Hugo Arts
On Tue, Jan 10, 2012 at 8:31 PM, Adrian wrote: > Hi guys, > I know that if i dont include any path information, python looks in the > current directory for the file. My question is how do i specify a file path > to open a file saved on my desktop for example. > > Thanks all > > Adrian > Just wr

Re: [Tutor] Removing certain sequences from a string list elements

2012-01-10 Thread Hugo Arts
On Sat, Jan 7, 2012 at 2:08 AM, Varsha Purohit wrote: > Hello, > > I have a simple python program where I am comparing two log files and I am > storing the differences in a list. I am programming in python after a long > time so may be I might have not written something very efficient. Please let

Re: [Tutor] Help with lag

2012-01-10 Thread Hugo Arts
On Wed, Jan 4, 2012 at 9:45 PM, Nate Lastname wrote: > Hello! > > The attached file 'cameramovement.py' is very laggy. Could someone help me > out by telling me what part of this is slowing it down so much?  I've > checked the whole file through, and I can't see why it's so slow. You'll > have to

Re: [Tutor] Moving from snippits to large projects?

2012-01-08 Thread Hugo Arts
On Mon, Jan 9, 2012 at 3:09 AM, Leam Hall wrote: > I'm taking the O'Reilly Python 2 course on-line, and enjoying it. Well, when > Eclipse works, anyway. I'm still getting the hang of that. > > While my coding over the years has been small snippits in shell, PHP, and a > little C, python, and perl,

Re: [Tutor] making a custom file parser?

2012-01-08 Thread Hugo Arts
On Mon, Jan 9, 2012 at 2:19 AM, Devin Jeanpierre wrote: >> Parsing XML with regular expressions is generally very bad idea. In >> the general case, it's actually impossible. XML is not what is called >> a regular language, and therefore cannot be parsed with regular >> expressions. You can use reg

Re: [Tutor] making a custom file parser?

2012-01-07 Thread Hugo Arts
On Sat, Jan 7, 2012 at 8:22 PM, Alex Hall wrote: > I had planned to parse myself, but am not sure how to go about it. I > assume regular expressions, but I couldn't even find the amount of > units in the file by using: > unitReg=re.compile(r"\(*)\") > unitCount=unitReg.search(fileContents) > print

Re: [Tutor] Using Python for a client interactive map application

2012-01-05 Thread Hugo Arts
On Thu, Jan 5, 2012 at 5:04 PM, James Reynolds wrote: > > > On Thu, Jan 5, 2012 at 10:58 AM, Alexander wrote: >> >> Dear friends, >> I'm emailing regarding a general question about working with Python and a >> web-browser based interactive map application. Over the summer I had asked a >> similar

Re: [Tutor] Game lag

2012-01-05 Thread Hugo Arts
On Thu, Jan 5, 2012 at 3:56 PM, Nate Lastname wrote: > Hello all, > > The attached zip file contains a file called 'cameramovement.py'.  As you > can see, this file is extremely laggy.  After searching through my code, I > can't find anything that is slowing it down.  Could someone help me out?  I

Re: [Tutor] while loop ends prematurly

2012-01-01 Thread Hugo Arts
On Mon, Jan 2, 2012 at 3:48 AM, brian arb wrote: > Hello, > Can some please explain this to me? > My while loop should continue while "owed" is greater than or equal to "d" > > first time the function is called > the loop exits as expected > False: 0.00 >= 0.01 > the next time it does not

Re: [Tutor] Class vs. instance

2012-01-01 Thread Hugo Arts
On Sun, Jan 1, 2012 at 8:40 PM, Stayvoid wrote: > Hi there! > class Sample:     def method(self): pass > Sample().method() > > What's the difference between class __main__.Sample and > __main__.Sample instance? > Why should I write "Sample().method" instead of "Sample.method"? > Th

Re: [Tutor] Which libraries for Python 2.5.2

2011-12-24 Thread Hugo Arts
On Sat, Dec 24, 2011 at 6:37 PM, Wayne Watson wrote: > I'm trying to restore Python 2.5.2 on an old PC for a particular application > that uses it from 4-5 years ago. > According to the latest manual on it, the following should be installed. > > python-2.5.2.msi > PIL-1.1.6.win32-py2.5.exe > numpy

Re: [Tutor] possibly a version error

2011-12-22 Thread Hugo Arts
On Thu, Dec 22, 2011 at 5:33 PM, Cranky Frankie wrote: > On the bottom of this web page: > > http://developer.yahoo.com/python/python-xml.html > > is a program that reads an RSS feed for the weather and then parses > the XML to show weather data by a zip code you input. I'm trying to > run this un

Re: [Tutor] 'str' object has no attribute 'description'

2011-12-18 Thread Hugo Arts
On Sun, Dec 18, 2011 at 11:23 PM, Wayne Werner wrote: > On Sun, Dec 18, 2011 at 4:06 PM, Russell Shackleton > wrote: >> >> I am learning Python classes by writing an adventure game. I have >> extracted just the relevant code. The player can look, go, drop, take, >> inventory but not examine. >> >

Re: [Tutor] reset password program

2011-12-16 Thread Hugo Arts
On Fri, Dec 16, 2011 at 11:49 PM, ADRIAN KELLY wrote: > thanks dave, > just tried writing to file for the first time > > def main(): >  outfile.write('Hello this is a test') >  outfile.close() > main() > > error, globalname outfile is not defined, do i need to import function to > get this working

Re: [Tutor] (no subject)

2011-12-12 Thread Hugo Arts
On Mon, Dec 12, 2011 at 3:56 AM, shawn taylor wrote: > firstname = raw_input ("Enter your first name ") > lastname = raw_input ("Enter your last name ") > idnumber = raw_input ("Enter your id number ") > birthday = raw_input ("Enter your birthday mm/dd/ ") > username1 = firstname[0] + lastname

Re: [Tutor] (no subject)

2011-12-11 Thread Hugo Arts
On Mon, Dec 12, 2011 at 2:00 AM, shawn taylor wrote: > I find it rude and offensive that you would make the assumption that this is > my homework, this is not my homework but a study guide for my final tomorrow > that I have no idea how to do. I have been working on this all day and this > was my

Re: [Tutor] (no subject)

2011-12-11 Thread Hugo Arts
On Sun, Dec 11, 2011 at 11:30 PM, shawn taylor wrote: > How do I do this > > > Password Generator > For this assignment, you will generate usernames and passwords for your > school. The passwords have to be secure and based on information provided by > the parents at registration. > 1) Write a pro

Re: [Tutor] Treating lists as lists

2011-11-29 Thread Hugo Arts
On Wed, Nov 30, 2011 at 2:09 AM, Mark Lybrand wrote: > I am pretty sure I saw this somewhere but now I can't.  Here's the problem: > list = ['hello', 'world'] > template = '%s %s' > print template % list > > But it appears that list is just one (list) when I want to treat it as two > (items).  I c

Re: [Tutor] How to handle conjunction operators

2011-11-27 Thread Hugo Arts
On Sun, Nov 27, 2011 at 7:52 PM, surya k wrote: > Hi, > Could you please tell me why this isn't working and how can I make it > possible... > Consider this code.. > > name = raw_input("Enter your first name: ") > if name[0] == ("m" or "f" or "b") : >rhyme = name[1:] > > What I want here is.. I

Re: [Tutor] How to raise error without the stack trace

2011-11-26 Thread Hugo Arts
On Sat, Nov 26, 2011 at 11:16 AM, Karim wrote: > > Hello, > > I want to fire my own exception without having the (useful but ugly in my > case) stack trace display. > > How to modify a Exception type class for that purpose which looks like: > > classs MyError(Exception): >       pass > > Cheers >

Re: [Tutor] write list of tuples to file (beginner)

2011-11-22 Thread Hugo Arts
On Tue, Nov 22, 2011 at 7:50 PM, Mayo Adams wrote: > I have a list of tuples of the form (string,integer) that I would like to > write  to  a file with a line break between each. Simply writing to a file > object thus > > for item in tuplelist >    outputfile.write (item) > > doesn't work,

Re: [Tutor] Stacks and Stack underflow/Stack overflow

2011-11-19 Thread Hugo Arts
On Sun, Nov 20, 2011 at 2:29 AM, Alan Gauld wrote: > On 20/11/11 00:09, Steven D'Aprano wrote: >> >> Walter Prins wrote: >> >>> pickle files are binary files and you probably opened it as a text file. >>> See here: http://docs.python.org/py3k/library/functions.html#open >> >> Not so. Pickle protoc

Re: [Tutor] positional output

2011-11-11 Thread Hugo Arts
On Fri, Nov 11, 2011 at 1:59 PM, Cranky Frankie wrote: > Thank you for your help on this. Now for "the rest of the story." > > I'm trying to build a script to parse IBM AIX DB2 DDL to line up the > data types (it drives me crazy when the column data types are not > lined up). For example, typical

Re: [Tutor] Handling exceptions

2011-11-07 Thread Hugo Arts
On Mon, Nov 7, 2011 at 12:52 PM, Gerhardus Geldenhuis wrote: > Hi > I am trying to handle exceptions for a xmlrpc class interfacing with > cobbler. > The exception: >  xmlrpclib.Fault: test_profile'"> > > and the experimental code. >   try: >     server = xmlrpclib.Server("http://192.168.2.11/cob

Re: [Tutor] Accessing methods in same class

2011-11-06 Thread Hugo Arts
On Sun, Nov 6, 2011 at 9:59 PM, Max S. wrote: > Hi.  I'm working on a project for my friend, but I'm running into errors. > No matter what I do, I can't seem to get one method to execute another > method in the same class.  Is there a way that I can do this?  Thanks. > Yes, you can do this, and i

Re: [Tutor] using separate py files for classes

2011-11-02 Thread Hugo Arts
On Wed, Nov 2, 2011 at 7:29 AM, Chris Hare wrote: > > I would like to put each of my classes in separate files to make it easier > to edit them and keep the various files as small as possible for editing > purposes. > I have come across a couple of problems: > 1.  I have to use import statements l

Re: [Tutor] Python 2.7 on Ubuntu 11.10 - Do not unintall

2011-11-01 Thread Hugo Arts
On Wed, Nov 2, 2011 at 7:26 AM, wrote: > Shouldn't this be treated as a bug then? As a user I should be allowed to > uninstall the software I want to. > Or you uninstalled other things by mistake? I don't think this is a bug. Python 2.7 is required software for both Gnome and Unity. Without it n

Re: [Tutor] Problem in running script

2011-11-01 Thread Hugo Arts
On Tue, Nov 1, 2011 at 10:47 PM, Narguess Dadfar wrote: > I want to prepare a script in python that updates the attributes of the > crime incidents falling within the patrol zone. I have  a point feature > class of crime incidents and a polygon feature class of patrol zone. > > I used the getcount

Re: [Tutor] A question about sys.argv

2011-11-01 Thread Hugo Arts
On Tue, Nov 1, 2011 at 2:48 PM, Jefferson Ragot wrote: > In a Vista command prompt if I typed this: > >     >>> python  somescript.py  filename > > Will sys.argv[1] return a valid path or just the filename? > If it just returns the filename, is there a simple way to get the path? > sys.argv c

Re: [Tutor] Paper Rock Scissors game - User's choice not returned properly

2011-10-31 Thread Hugo Arts
On Mon, Oct 31, 2011 at 4:41 PM, Joel Montes de Oca wrote: > Hello everyone, > > I am having a little trouble with a block of code that isn't behaving the > way I would expect. Maybe you can give me a hand and point where it is going > wrong. > > The function that is not working correctly belongs

Re: [Tutor] Performance measurement tools

2011-10-18 Thread Hugo Arts
On Tue, Oct 18, 2011 at 10:49 AM, Ashish Gaonker wrote: > Hi > Can you suggest the best performance measurent tools for python programs. > specifically thread based python modules. > -- > Thanks & Regards > Ashish Gaonker I've heard very good things about yappi: http://code.google.com/p/yappi/ _

Re: [Tutor] Socket and Ports

2011-10-16 Thread Hugo Arts
On Sun, Oct 16, 2011 at 4:20 PM, bob gailer wrote: > On 10/16/2011 8:28 AM, Jacob Bender wrote: >> >> Dear Tutors, >> >>     I've been having an issue with socket. I wanted to use it for >> transmitting strings over the Internet. > > That's good, because strings is all you can transmit. > >> The p

Re: [Tutor] Can I set LD_LIBRARY_PATH within a .py file?

2011-10-15 Thread Hugo Arts
On Sat, Oct 15, 2011 at 9:51 PM, Albert-Jan Roskam wrote: > Hello, > Can I set the LD_LIBRARY_PATH environment variable (on-the-fly) within a .py > file? > I would like to use an .so-file that lives in a non-standard location. > > This does not work: > try: >    os.environ["LD_LIBRARY_PATH"]  += (

Re: [Tutor] Parsing /etc/passwd

2011-10-12 Thread Hugo Arts
On Wed, Oct 12, 2011 at 3:41 PM, Gerhardus Geldenhuis wrote: > Hi > I wrote the following code: >   f = open('/etc/passwd', 'r') >   users = f.read() >   userelements = re.findall(r'(\w+):(\w+):(\w+):(\w+):(\w+):(\w+):(\w+)', > users) >   print userelements >   for user in userelements: >     (use

  1   2   3   >