Re: [Tutor] Object references and garbage collection confusion

2015-05-05 Thread Dave Angel
On 05/05/2015 12:29 AM, Brandon D wrote: Hello tutors, I'm having trouble understanding, as well as visualizing, how object references work in the following situation. For demonstration purposes I will keep it at the most rudimentary level: x = 10 x = x ** x If my knowledge serves me correct

Re: [Tutor] key detection

2015-05-06 Thread Dave Angel
On 05/06/2015 12:02 AM, Jim Mooney Py3.4.3winXP wrote: actually worked in windows instead of using their awful screen copy. What a surprise: Many people don't realize that you can turn on a better screen copy feature for the CMD window (DOS box) in Windows. I've given up Windows, and no lon

Re: [Tutor] Fwd: Re: Adding consecutive numbers

2015-05-06 Thread Dave Angel
On 05/06/2015 07:51 AM, Alan Gauld wrote: Please use ReplyAll to include the list members. Forwarded Message Subject: Re: [Tutor] Adding consecutive numbers Date: Wed, 6 May 2015 21:13:15 +1000 From: Whom Isac To: Alan Gauld Thanks for the reply. I am sorr

Re: [Tutor] key detection

2015-05-06 Thread Dave Angel
On 05/06/2015 01:41 PM, Jim Mooney Py3.4.3winXP wrote: from msvcrt import * while True: if kbhit(): key = getch() if key == b'\xe0' or key == b'\000': print('special key follows') key = getch() print(str(key, encoding='utf-8')) #got

Re: [Tutor] pointer puzzlement

2015-05-07 Thread Dave Angel
On 05/07/2015 04:03 PM, Emile van Sebille wrote: On 5/7/2015 12:15 PM, Jim Mooney Py3.4.3winXP wrote: I find this a bit confusing. Since the ID of K remains the same, so it's the same object, why isn't it increasing each time. i.e, 20, 30, 40,. I understand that it's immutable but doesn't that m

Re: [Tutor] pointer puzzlement

2015-05-07 Thread Dave Angel
On 05/07/2015 03:15 PM, Jim Mooney Py3.4.3winXP wrote: I find this a bit confusing. Since the ID of K remains the same, so it's the same object, why isn't it increasing each time. i.e, 20, 30, 40,. I understand that it's immutable but doesn't that mean K is created each time in local scope so it

Re: [Tutor] pointer puzzlement

2015-05-07 Thread Dave Angel
On 05/07/2015 04:54 PM, Jim Mooney Py3.4.3winXP wrote: On 7 May 2015 at 13:03, Emile van Sebille wrote: Compare to: def testid(K=100): K += 10 return 'the ID is', id(K), K Ah, thanks. I forgot small integers are saved in a table. I was looking at a demo that pointers to def

Re: [Tutor] pointer puzzlement

2015-05-07 Thread Dave Angel
On 05/07/2015 05:25 PM, Alan Gauld wrote: On 07/05/15 21:54, Jim Mooney Py3.4.3winXP wrote: Ah, thanks. I forgot small integers are saved in a table. I was looking at a demo that pointers to defaults in function parameters are persistent. But remember they variables are NOT pointers. They are

Re: [Tutor] pointer puzzlement

2015-05-07 Thread Dave Angel
On 05/07/2015 07:51 PM, Dave Angel wrote: On 05/07/2015 04:54 PM, Jim Mooney Py3.4.3winXP wrote: On 7 May 2015 at 13:03, Emile van Sebille wrote: Compare to: def testid(K=100): K += 10 return 'the ID is', id(K), K Ah, thanks. I forgot small integers are saved

Re: [Tutor] introspection

2015-05-07 Thread Dave Angel
On 05/07/2015 09:50 PM, Alex Kleider wrote: On 2015-04-21 16:48, Cameron Simpson wrote: But it would not be schizophrenic to write a function that returned a name arbitrarily, by inspecting locals(). It depends whether you only need a name, or if you need "the" name. Write yourself a "find_nam

Re: [Tutor] introspection

2015-05-07 Thread Dave Angel
On 05/07/2015 11:23 PM, Alex Kleider wrote: On 2015-05-07 19:10, Dave Angel wrote: def get_name(localmap, item): """As suggested. Returns 'a' name, not necessarily 'the' name.""" for name in localmap: if localmap[

Re: [Tutor] introspection

2015-05-08 Thread Dave Angel
On 05/08/2015 02:26 AM, Alex Kleider wrote: On 2015-05-07 20:45, Dave Angel wrote: You also only showed it working on module globals. (For code at top-level, locals() returns the same as globals() ) You could also try it inside functions, where locals() really makes sense as a name. And you

Re: [Tutor] pointer puzzlement

2015-05-08 Thread Dave Angel
On 05/08/2015 02:10 PM, Jim Mooney Py3.4.3winXP wrote: On 7 May 2015 at 18:42, Dave Angel wrote: Python doesn't have pointers So what is the difference between a python name and a pointer? I'm a bit fuzzy on that. What's the difference between a painting of Obama and

Re: [Tutor] formatting strings

2015-05-08 Thread Dave Angel
On 05/07/2015 02:57 PM, Tudor, Bogdan - tudby001 wrote: Hi, This is my first time. First time doing what? Presumably the first time on this forum. But what is your history of using Python, or of programming in general? I am using python 3.4.3 on windows 7 64bit. I am trying to make a bi

Re: [Tutor] pointer puzzlement

2015-05-08 Thread Dave Angel
On 05/08/2015 06:26 PM, Alan Gauld wrote: On 08/05/15 19:10, Jim Mooney Py3.4.3winXP wrote: On 7 May 2015 at 18:42, Dave Angel wrote: Python doesn't have pointers So what is the difference between a python name and a pointer? OK, This could get deepo. Lets start with the supoerf

Re: [Tutor] split a string inside a list

2015-05-09 Thread Dave Angel
On 05/09/2015 04:13 AM, Alan Gauld wrote: On 09/05/15 04:24, Kayla Hiltermann wrote: i want to account for variability in user input, > like using commas or just spaces. the user input is initially a string, but is converted to a list once > run through .split() . > I would like to split

Re: [Tutor] Design question: Web-based vs. desktop-based vs. desktop-based with data backed up to web server with a tablet thrown in for all cases?

2015-07-19 Thread Dave P
reporting (using Python, of course!) I'll be glad to help you and your wife off-list if you'd like some pointers. Good luck! Dave ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] unittest not working

2015-11-19 Thread Dave P
On Thu, Nov 19, 2015 at 8:25 AM, Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, so > I'm sure I'm missing

Re: [Tutor] Recommendations for best tool to write/run Python

2016-03-02 Thread Dave P
On Wed, Mar 2, 2016 at 1:26 PM, Lisa Hasler Waters wrote: > Hello everyone, > > I am new to Python, as are my middle school students. We are using Python > 3.5.1 IDLE to write and run our (simple) code. However, this tool does not > seem to be the best way to write longer code or to be able to re-

Re: [Tutor] Str method

2012-11-04 Thread Dave Angel
On 11/04/2012 08:45 PM, Ashley Fowler wrote: > I'm trying to initialize a list to several elements using the string method. > I have some idea that you use a for loop I suppose... > > Could anybody help me out? > > list has no string method, at least in the versions I tried.Could you perhaps

Re: [Tutor] Str method

2012-11-04 Thread Dave Angel
On 11/04/2012 09:01 PM, Ashley Fowler wrote: (You top-posted, so I have to remove all the historical context, or it'll remain out of order) > I have code for a Set ADT. The Set ADT is a container that stores a > collection of values or elements. > > > > > Below is some of my code...I have run in

Re: [Tutor] serial to parallel

2012-11-05 Thread Dave Angel
On 11/05/2012 06:53 AM, Bala subramanian wrote: > Friends, > In the previous mail there was an "mistake" i was not aware of. So pls > dnt get upset. > > For frame in trajectory-A: >> cunt= str(frame.time) > It is count =str(frame.time). A counter to find frame number. > > Thanks joel for le

Re: [Tutor] Help with class example

2012-11-05 Thread Dave Angel
On 11/05/2012 06:07 PM, Prasad, Ramit wrote: > Frank Pontius wrote: >> Sent: Saturday, October 27, 2012 12:27 PM >> To: d...@davea.name; bgai...@gmail.com >> Cc: tutor@python.org >> Subject: Re: [Tutor] Help with class example >> >> Here ya go! >> Can't do what you want as this is a programmatic er

Re: [Tutor] help on dic creation

2012-11-06 Thread Dave Angel
On 11/06/2012 09:01 AM, Mark Lawrence wrote: > On 31/10/2012 01:01, Brayden Zhao wrote: > >> def fieldict(filename): >>D={} >>with open(filename) as FileObject: >> for lines in FileObject: >>linelist=lines.split('\t') >>Key=linelist[0] >>ValCity=(linelist[12]).s

Re: [Tutor] web scraping using Python and urlopen in Python 3.3

2012-11-07 Thread Dave Angel
On 11/07/2012 10:44 AM, Seema V Srivastava wrote: > Hi, > I am new to Python, trying to learn it by carrying out specific tasks. I > want to start with trying to scrap the contents of a web page. I have > downloaded Python 3.3 and BeautifulSoup 4. > > If I call upon urlopen in any form, such as b

Re: [Tutor] web scraping using Python and urlopen in Python 3.3

2012-11-07 Thread Dave Angel
On 11/07/2012 11:25 AM, Walter Prins wrote: > Seema, > > On 7 November 2012 15:44, Seema V Srivastava wrote: > >> Hi, >> I am new to Python, trying to learn it by carrying out specific tasks. I >> want to start with trying to scrap the contents of a web page. I have >> downloaded Python 3.3 and

Re: [Tutor] Telnet login

2012-11-08 Thread Dave Angel
On 11/08/2012 09:33 PM, T. Girowall wrote: > > ip: 192.168.xx.xx > port: 2332 > > Any help is appreciated, > Tim > import getpass import sys import telnetlib HOST = "localhost" user = > raw_input("Enter your remote account: ") password = getpass.getpass() tn = > telnetlib.Telnet(HOST) tn.read_u

Re: [Tutor] Telnet login

2012-11-08 Thread Dave Angel
"\n") if password: tn.read_until("Password: ") tn.write(password + "\n") tn.write("ls\n") tn.write("exit\n") print tn.read_all() >>> >>> > Dave Angel wrote: >> >> This is a text mailing list; your html mail thorough

Re: [Tutor] Parsing a multi-line/record text file

2012-11-10 Thread Dave Angel
On 11/11/2012 12:01 AM, Marc wrote: > Hello, > > I am trying to parse a text file with a structure that looks like: > > [record: Some text about the record] So the record delimiter starts with a left bracket, in first column? And all lines within the record are indented? Use this fact. >

Re: [Tutor] Connecting to a DB via a function call

2012-11-11 Thread Dave Angel
On 11/11/2012 06:39 AM, Khalid Al-Ghamdi wrote: > Hi, > > Why is it that the following even though I call the below function? And how > do I write a function that makes connection that I can use to query my DB? > > Traceback (most recent call last): > File "C:/Python33/My Stuff/schedule_machine/s

Re: [Tutor] Questions about classes

2012-11-13 Thread Dave Angel
On 11/12/2012 09:49 PM, brandon w wrote: > I have been trying to understand classes. I have been studying from a book > I picked up recently. > I have two questions about them. > > 1. I saw in the book an assignment written like this: > > class HumanBeing: > def makeName(self, name): >

Re: [Tutor] writing files using modules and functions

2012-11-13 Thread Dave Angel
On 11/13/2012 01:43 AM, Rufino Beniga wrote: > def MatInv(arr,file): > f = open('file.txt','w') > f.write(arr) > f.close() > > So I'm trying to write a module that will take a matrix (arr) and write it > to a text file. > The above module is called MatrixIO.py > > #first I import it > >

Re: [Tutor] LCM

2012-11-14 Thread Dave Angel
On 11/14/2012 12:52 PM, Selby Rowley Cannon wrote: > Hey, > > I've been trying to write a function to find the Lowest Common > Multiple of two numbers, but it isn't working and I've kinda hit a > dead end on the thought-process end of things. Anyone mind looking at > it, and tell me what's wron

Re: [Tutor] LCM

2012-11-14 Thread Dave Angel
On 11/14/2012 01:34 PM, Selby Rowley Cannon wrote: > On 14/11/12 18:27, Dave Angel wrote: >> On 11/14/2012 12:52 PM, Selby Rowley Cannon wrote: >>> Hey, >>> Tell us what version of Python you're targeting. I'm going to assume 2.x, since you have print witho

Re: [Tutor] unicode help

2012-11-14 Thread Dave Angel
On 11/14/2012 03:10 PM, Marilyn Davis wrote: > Hi, > > Last year, I was helped so that this ran nicely on my 2.6: > > #! /usr/bin/env python > # -*- coding: utf-8 -*- > # necessary for python not to complain about "¥" > > symbol = unichr(165) > print unicode(symbol) > > --- end of code --- > > But,

Re: [Tutor] unicode help

2012-11-14 Thread Dave Angel
On 11/14/2012 04:07 PM, Marilyn Davis wrote: > > > Goodness! I didn't expect it to be a Mac thing. > > So, on a Windows machine, running Python 2.6.6, sys.stdout.encoding is > 'cp1252', yet the code runs fine. > > On Ubuntu with 2.7, it's 'UTF-8' and it runs just fine. > > I find this most myste

Re: [Tutor] Plot multiple lines using python / basemap

2012-11-15 Thread Dave Angel
On 11/15/2012 04:20 AM, Boris Vladimir Comi wrote: > > Hi all: > > I have begun to learn about python / matplolib / basemap and really need some > help. > > My data is in an Excel workbook with the following structure: > > Evento FechaLatitud

Re: [Tutor] Quick question about definitions.

2012-11-17 Thread Dave Angel
On 11/16/2012 12:28 PM, sillywilly98 wrote: > I know this code is not fully debugged. I just cant see why 1 definition is > wrong. > Here is the code: > # This program draws a robot. > > from turtle import * > > def draw_eyes(): > # This fu

Re: [Tutor] LCM

2012-11-18 Thread Dave Angel
On 11/18/2012 12:50 PM, Andrew wrote: > On Wed, 14 Nov 2012 19:52:03 +0200, Selby Rowley Cannon > wrote: > >> Hey, >> >> I've been trying to write a function to find the Lowest Common >> Multiple of two numbers, but it isn't working and I've kinda hit a >> dead end on the thought- >> I hav

Re: [Tutor] Beginner's question

2012-11-22 Thread Dave Angel
On 11/22/2012 10:14 AM, Joel Goldstick wrote: >> > Peter O'Doherty wrote: >>> > > >>> < snip > >>> > > I need to write a program that examines 3 variables x, y, z, and prints >>> > > the largest odd number. I've tried all sorts of variations and this is >>> > > the current version: >>> > > > x

Re: [Tutor] Beginner's question

2012-11-22 Thread Dave Angel
On 11/22/2012 02:50 PM, eryksun wrote: > On Thu, Nov 22, 2012 at 10:49 AM, Dave Angel wrote: >> >>> >>> >> >> This one first gets into trouble if x is even and y is odd, because if >> tries to compare y with None, which is basically an undefined

Re: [Tutor] Beginner's question

2012-11-22 Thread Dave Angel
On 11/22/2012 06:57 PM, eryksun wrote: > On Thu, Nov 22, 2012 at 6:49 PM, Steven D'Aprano wrote: >>> will give the same answer each time, for a single run of a script in >>> CPython, but it is unspecified what that answer will be, and may vary by >>> version as well as implementation. >> Correct.

Re: [Tutor] doctest question

2012-11-27 Thread Dave Angel
On 11/27/2012 04:50 AM, Albert-Jan Roskam wrote: > >> On 27/11/12 08:06, Albert-Jan Roskam wrote: >>> (Steven D'Aprano wrote, even though the indentation is wrong) >>> >>> >>> >>> Doctesting anything to do with dictionaries is tricky, because you >>> cannot rely on the order of a dict. There are

[Tutor] manipulating a string in python

2012-11-27 Thread Dave Wilder
or example, can I just eliminate "media-capabilities", "{" and "}" right off the bat and then do a split on "\n"? Should I use "re" matching for this? I could also just a single split('\n') and then inside the loop ignore everyt

Re: [Tutor] manipulating a string in python

2012-11-27 Thread Dave Angel
On 11/27/2012 11:49 AM, Dave Wilder wrote: Could you please use text mode in your messages? Your email editor produces double-spacing when it converts the html stuff you wrote into the text this forum supports. > > > I believe there is a simple answer to this, but I am confuse

Re: [Tutor] reverse diagonal

2012-12-01 Thread Dave Angel
On 12/01/2012 10:40 AM, richard kappler wrote: > I'm working through Mark Lutz's "Python," reviewing the section on lists. I > understand the list comprehension so far, but ran into a snag with the > matrix. I've created the matrix M as follows: > > M = [[1, 2, 3[, [4, 5, 6], [7, 8, 9]] There's an

Re: [Tutor] reverse diagonal

2012-12-01 Thread Dave Angel
On 12/01/2012 11:28 AM, Brian van den Broek wrote: > On 1 December 2012 10:40, richard kappler wrote: >> I'm working through Mark Lutz's "Python," reviewing the section on lists. I >> understand the list comprehension so far, but ran into a snag with the >> matrix. I've created the matrix M as fol

Re: [Tutor] reverse diagonal

2012-12-01 Thread Dave Angel
On 12/01/2012 09:19 PM, eryksun wrote: > On Sat, Dec 1, 2012 at 11:31 AM, Dave Angel wrote: >> >> revdiag = [M[i][len(M)-1-i] for i in range(len(M)) ] > > You might sometimes see this using the bitwise invert operator ~ (i.e. > __invert__, operator.invert): > >

Re: [Tutor] reverse diagonal

2012-12-01 Thread Dave Angel
On 12/01/2012 09:55 PM, eryksun wrote: > On Sat, Dec 1, 2012 at 9:35 PM, Dave Angel wrote: >> >> [M[i][~i] for i,dummy in enumerate(M) ] > > Since enumerate() iterates the rows, you could skip the first index: > > >>> [row[~i] for i,row in enumerate(

Re: [Tutor] To Find the Answers

2012-12-01 Thread Dave Angel
On 12/01/2012 11:39 PM, Sujit Baniya wrote: > *Write a function named countRepresentations that returns the > number*>* of ways that an amount of money in rupees can be represented > as rupee*>* notes. For this problem we only use rupee notes in > denominations of*>* 1, 2, 5, 10 and 20 rupee notes

Re: [Tutor] 1 to N searches in files

2012-12-02 Thread Dave Angel
On 12/02/2012 03:53 AM, Spectral None wrote: > Hi all > > I have two files (File A and File B) with strings of data in them (each > string on a separate line). Basically, each string in File B will be compared > with all the strings in File A and the resulting output is to show a list of > match

Re: [Tutor] how to struct.pack a unicode string?

2012-12-02 Thread Dave Angel
On 12/02/2012 08:34 AM, Albert-Jan Roskam wrote: > > > > > > > Hi Eryksun, > > Observation #1: Yes, makes perfect sense. I should have thought about that. > Observation #2: > As I emailed earlier today to Peter Otten, I thought unicode_internal means > UCS-2 or UCS-4, > depending on the size o

Re: [Tutor] 1 to N searches in files

2012-12-03 Thread Dave Angel
On 12/03/2012 10:46 AM, Spectral None wrote: > > Hi Dave > > Your solution seems to work: > > setA = set(FileA) > setB = set(FileB) > > for line in setB: > if line in setA: > matched_lines.writelines(line) > else: > non_matched_lines.writeline

Re: [Tutor] On understanding defintions

2012-12-04 Thread Dave Angel
On 12/04/2012 01:29 PM, frank ernest wrote: > Opensuse 12.2 python3.2 > I discoverd that some of the examples for definitions in the tutorial are > not valid. I am reporting this as a bug. And what are the bug numbers? Or links to the bug reports? Otherwise why are you telling us about them wi

Re: [Tutor] On understanding defintions

2012-12-04 Thread Dave Angel
les you found "bugs" in. Could be the page they're on was meant for a different version of Python than what you're running. For example, in Python 2.x, 'print' was a statement, while in 3.x it's a function. >> - Original Message - >> From:

Re: [Tutor] I'm trying to wrap my head around defs

2012-12-04 Thread Dave Angel
On 12/04/2012 04:51 PM, frank ernest wrote: > Opensuse 12.2 python3.2 > I'm having trouble understanding them. > Python is my first language... excluding English. > I've already read ALL OF THE PYTHON Language Referance and I still don't > "get it." You usually should start with a tutorial, no

Re: [Tutor] Get/Set/Attribute Accessors in Python?

2012-12-05 Thread Dave Angel
On 12/05/2012 10:38 AM, Malcolm Newsome wrote: > Hey Tutors, > > Python is/was my first language. Yet, I've recently begun learning C# for > my new job. > > One thing I've come across in C# (and, quite frankly, am having a difficult > time grasping) is Get and Set (Accessors). > > Since, I don't e

Re: [Tutor] Tutor Digest, Vol 106, Issue 5

2012-12-05 Thread Dave Angel
On 12/05/2012 03:50 PM, Prasad, Ramit wrote: > >> >> Not to mention that as social conventions regarding email have moved >> on--e.g. top posting--for the majority of email users A bug that somehow convinced people that it was "normal." So other implementers copied the bug. -- DaveA __

Re: [Tutor] Tutor Digest, Vol 106, Issue 5

2012-12-05 Thread Dave Angel
On 12/05/2012 04:22 PM, Alan Gauld wrote: > > > > PPS. > There is one advantage to lazy top posting. When I return from > vacation I sort by subject and only open the most recent in a thread. > That way I can read up from the bottom and get all the others in one > go. I then just delete the rest u

Re: [Tutor] reading web page with BeautifulSoup

2012-12-12 Thread Dave Angel
On 12/12/2012 08:47 PM, Ed Owens wrote: > >>> from urllib2 import urlopen > >>> page = urlopen('w1.weather.gov/obhistory/KDCA.html') > Traceback (most recent call last): > File "", line 1, in > File > "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", > line 1

Re: [Tutor] New Re: Clearing Python text

2012-12-14 Thread Dave Angel
On 12/14/2012 10:25 AM, Waters, Mike [ITSCA Non-J&J] wrote: > Hi Tutor, > I am using Win 7 ,Python 2.7. Interpreter. > To state my challenge : When I have filled a page with values and text until > it reaches the bottom of the screen, how can I highlight this and remove to > allow further entries

Re: [Tutor] Get the structure values from a c file

2012-12-16 Thread Dave Angel
On 12/16/2012 10:12 PM, Marefe Serentas wrote: > Hi, I need help. > > I want to create a python script that will store the value of the > structure /MainStruct/ from the c file. > Suppose my c file looks like this: > -- > #define max (3) > > t

Re: [Tutor] Get the structure values from a c file

2012-12-18 Thread Dave Angel
On 12/17/2012 11:25 PM, Marefe Serentas wrote: > On 12/18/2012 12:38 AM, tutor-requ...@python.org wrote: >> Re: Get the structure values from a c file > I apologize for some syntax errors in my c file. I would like to correct > my mistakes and append some lines in the c file to make it clearer. > >

Re: [Tutor] need help with python for counter

2012-12-19 Thread Dave Angel
On 12/19/2012 12:40 AM, Brandon Merritt wrote: > I feel silly, but I'm having the darndest time trying to figure out why > this for counter won't work. I know that there is the count method for the > string class, but I was just trying to do it the syntactical way to prove > myself that I know the

Re: [Tutor] how to control putty window

2012-12-20 Thread Dave Angel
On 12/20/2012 09:25 AM, Ufuk Eskici wrote: > > I run this command and opens putty: > > import os > import subprocess > command = '"c:\Program Files\Putty\putty.exe" -ssh > ufukeskici@10.10.10.10-pw test > subprocess.Popen(command) > > You really should use cut and paste when trying to tell us what

Re: [Tutor] invalid literal for int error in Game loop

2012-12-20 Thread Dave Angel
On 12/20/2012 03:51 PM, Steven D'Aprano wrote: > On 21/12/12 07:40, Ciaran Mooney wrote: > >> def difficultyLevel(): >> FPS = '' > > Here you set the variable FPS to the empty string. > >> if event.type == KEYDOWN: >> if event.key == ord('b'): >> FPS = 30

Re: [Tutor] invalid literal for int error in Game loop

2012-12-20 Thread Dave Angel
On 12/20/2012 04:34 PM, Ciaran Mooney wrote: > Thanks for the feedback. > > Steve, If I set the FPS to a default of say 30, the game seems to run at this > default FPS=30 regardless of the key pressed in the function. > > Dave, If I remove the the default value at the start o

Re: [Tutor] check it for me

2012-12-22 Thread Dave Angel
On 12/22/2012 04:02 PM, Farrukh Ali wrote: > Hi Tutor, > > I am new to python, and a novice in the world of programming, I am learning > python from learnpythonthehardway, and now a little bit confused in exercise > 3, where the author of the book wants us to rewrite the ex3.py by saying > Rewri

Re: [Tutor] check it for me

2012-12-22 Thread Dave Angel
On 12/22/2012 05:38 PM, Farrukh Ali wrote: > Hi, i am using ActivePython 2.7.2.5, and windows 8 professional. > well the original ex3.py is: > print "I will now count my chickens:" > print "Hens", 25 + 30 / 6 > print "Roosters", 100 - 25 * 3 % 4 > print "Now I will count the eggs:" > print 3 + 2 +

Re: [Tutor] For Loop Question

2012-12-23 Thread Dave Angel
On 12/23/2012 09:02 PM, Alan Gauld wrote: > On 24/12/12 01:16, Mitya Sirenef wrote: >> On 12/23/2012 08:03 PM, Tom Tucker wrote: >>> >>> >>> Python Gurus, >>> I got a question for ya. Below I have three instance variables >>> (self.A, self.B, etc). How can I use the below >>> for loop for A, B, C

Re: [Tutor] how to control putty window

2012-12-27 Thread Dave Angel
On 12/27/2012 04: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 = paramiko.SSHClient

Re: [Tutor] Trouble importing Paramiko

2012-12-27 Thread Dave Angel
On 12/27/2012 06:44 AM, Ufuk Eskici wrote: First comment: please don't top-post. You've done it many times now, and it's not how this forum works. Put your comments after the parts you're quoting. (My email is mostly busted; I've been trying to send this for hours) First question: what vers

Re: [Tutor] another for loop question - latin square

2012-12-30 Thread Dave Angel
On 12/30/2012 06:59 PM, Brandon Merritt wrote: > I am having trouble Please tell us what Python version you're targeting. It looks like 2.7, but you really should specify it for us. Next, you should tell us your skill level; are you experienced at another language and learning Python, or what?

Re: [Tutor] another for loop question - latin square (was: Tutor Digest, Vol 106, Issue 74)

2013-01-01 Thread Dave Angel
On 01/01/2013 08:27 PM, Brandon Merritt wrote: > Sorry, I should have been more clear in what I was trying to accomplish. I > am trying to build the latin square as follows: > > 1234567 > 2345671 > 3456712 > 4567123 > 5671234 > 6712345 > 7123456 > > So, the "scaleorder" is the n*n scale of the squa

Re: [Tutor] Limitation of int() in converting strings

2013-01-02 Thread Dave Angel
On 01/02/2013 11:41 AM, Steven D'Aprano wrote: > > > The bit about __index__ refers to using trunc(): > > "I still really wish I had followed Pascal's lead instead of C's here: > Pascal requires you to use trunc() to convert a real to an integer. ... > If we had done it that way, we wouldn't have

Re: [Tutor] Python Programming for Absolute Beginner

2013-01-02 Thread Dave Angel
On 01/02/2013 08:20 PM, Conor Grevlos wrote: > I downloaded the python source folder, with chapters 1 through 12 I think. > But it just opens up the program that is already built, not one that shows me > the code. > Starting a new thread with each message is unproductive and impolite. If you ac

Re: [Tutor] Decorators: Are they good for checking inputs and outputs?

2013-01-06 Thread Dave Angel
On 01/06/2013 07:13 PM, DoanVietTrungAtGmail wrote: > *.. Could you perhaps give a concrete example of a situation where > a decorator would be useful for checking the inputs to a function? .. Oscar* > > Say I write a function that expects 5 positional arguments, and up to 4 ** > arguments. Now I w

Re: [Tutor] Here is code, no link for my previous question

2013-01-06 Thread Dave Angel
On 01/06/2013 09:07 PM, Jack Little wrote: > Here is the code, my error is below the code in itallics This is a text mailing list, italics aren't generally visible. If you want to highlight a line, add a useful comment to it. But the problem here is your scoping. All those globals make no sens

Re: [Tutor] Flow charts

2013-01-09 Thread Dave Angel
On 01/09/2013 09:26 PM, Ed Owens wrote: > I'm working my way through Chun's book "Core Python Applications > Programming" and can't get one of the examples to actually work. In > trying to analyze the problem (good learning approach) I had troubles > understanding the interactions between the two

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

2013-01-10 Thread Dave Angel
On 01/10/2013 06:36 AM, Tobias M. wrote: > Peter Otten wrote: >> Build the list outside the class: MyClass.method_list = [MyClass.bar] > Thanks, that is a solution. But I don't really like to put the list > outside the class as it is strongly related to the class and not used > outside. But as it

Re: [Tutor] garbage collection/class question

2013-01-10 Thread Dave Angel
On 01/10/2013 09:06 AM, richard kappler wrote: Since you don't specify Python version or implementation, I'll use CPython version 2.7 for the details below. Jython (for java environments) and other implementations are likely to differ in their garbage collection details. But the effect will be t

Re: [Tutor] garbage collection/class question

2013-01-11 Thread Dave Angel
On 01/11/2013 02:41 PM, Jan Riechers wrote: > On 10.01.2013 19:50, Mitya Sirenef wrote: >> On 01/10/2013 09:06 AM, richard kappler wrote: >> >> class Tree(object): >> height = 0 >> >> def grow(self): >> self.height += 1 >> >> You may have a dozen of related functions and you can

Re: [Tutor] Binary/Decimal convertor

2013-01-11 Thread Dave Angel
On 01/11/2013 04:51 PM, Ghadir Ghasemi wrote: > Hi, I made a program called binary/denary convertor. Can anyone tell me about > how I could stop the user entering a binary number with more than 8 numbers > or 8 bit by repeating the question over and over until they do enter a > correct binary nu

Re: [Tutor] Working with output of a subprocess

2013-01-11 Thread Dave Angel
On 01/11/2013 05:29 PM, 3n2 Solutions wrote: > Hello, > > Need some help with working with a text file. > Is it possible to get the values associated with each of the parameter in > the below text file format? For example: There are no intrinsic parameters and values in a text file. it's free for

Re: [Tutor] run perl script files and capture results

2013-01-11 Thread Dave Angel
On 01/11/2013 07:33 PM, Prasad, Ramit wrote: > [snip] > Why not just use r'C:\Python27\\'? Might be too confusing for > a beginner to remember, I suppose. > > Because that'd have two trailing backslashes. (in Python 2.7 anyway) -- DaveA ___ Tutor m

Re: [Tutor] (no subject)

2013-01-12 Thread Dave Angel
On 01/12/2013 12:32 PM, Ali Raza Ghasemi wrote: > I have to make a program that adds binary numbers together. The program has > to accept two binary values (up to 8 binary digits) and output their total in > binary. The output should not contain any leading zeros. > I have a problem in that I don

Re: [Tutor] Adding Binary

2013-01-12 Thread Dave Angel
On 01/12/2013 03:43 PM, Ali Raza Ghasemi wrote: > I am making a program that adds binary numbers together. The program has to > accept two binary values (up to 8 binary digits) and output their total in > binary. The output should not contain any leading zeros. > I have a problem in that I don't

Re: [Tutor] text files

2013-01-15 Thread Dave Angel
On 01/15/2013 09:31 PM, Gina wrote: I have version 3 I am trying to read a text file ("the_file.txt") and then write a new file where the characters are in uppercase but i don't know how/where i should use the .upper I think i should use it where the ** is, but i got errors when i tried t

Re: [Tutor] Set LD_LIBRARY_PATH and equivalents platform-independently

2013-01-16 Thread Dave Angel
On 01/16/2013 07:05 PM, Alan Gauld wrote: On 16/01/13 21:06, Albert-Jan Roskam wrote: Is there a builtin function that can set LD_LIBRARY_PATH or equivalents platform-independently? No. But there is putenv() in the os module. But how well it works across OS I'm not sure. I don't recall eno

Re: [Tutor] Python's OOP-Inheritance make me confuse.

2013-01-19 Thread Dave Angel
On 01/19/2013 02:08 AM, Moore John wrote: Hi, I am new to Python language. I have only 10 days experience on it. When I start learning there is no difficult, but it make me slow down when I reach "Object Oriented Concept", especially "Inherited". Some of my background knowledge about "Inherited i

Re: [Tutor] Calculate hours

2013-01-22 Thread Dave Angel
On 01/22/2013 09:52 PM, anthonym wrote: Hello All, I originally wrote this program to calculate and print the employee with the most hours worked in a week. I would now like to change this to calculate and print the hours for all 8 employees in ascending order. The employees are named employee

Re: [Tutor] Calculate hours

2013-01-22 Thread Dave Angel
On 01/22/2013 10:08 PM, Mitya Sirenef wrote: On 01/22/2013 09:52 PM, anthonym wrote: Hello All, > > I originally wrote this program to calculate and print the employee > with the most hours worked in a week. I would now like to change this > to calculate and print the hours for all 8 employ

Re: [Tutor] Calculate hours

2013-01-23 Thread Dave Angel
On 01/22/2013 11:18 PM, anthonym wrote: Thanks Dave I think I would like to keep it simple. How would I get it to repeat and print before deleting? To repeat something, write a loop. So you have a while loop *outside* the one you've written (you'll have to indent your present lo

Re: [Tutor] Calculate hours

2013-01-23 Thread Dave Angel
On 01/23/2013 06:13 PM, Alan Gauld wrote: On 23/01/13 03:08, Mitya Sirenef wrote: To make the change you need, use list comprehension to make sums of all rows, sort it (using list sort method); iterate over it using enumerate() and print out "employee N, sum of hours:" One problem with that a

Re: [Tutor] how can i use python 2 alongside 3?

2013-01-24 Thread Dave Angel
On 01/24/2013 08:46 AM, Matthew Ngaha wrote: hi guys i am a python 3.1.1. user but really need to use python 2 to be able to use certain libraries and frameworks. i have installed python 2.7 but they cant run together as all .py and .pyw files are opened with python 3. i can open simple python 2

Re: [Tutor] how can i use python 2 alongside 3?

2013-01-24 Thread Dave Angel
On 01/24/2013 11:11 AM, Matthew Ngaha wrote: Python 3.3 for Windows comes with a "launcher", which will approximate (for Python only) what Unix and Linux users have had for years for any scripting language. You can get it separately, as Mark Lawrence has said, but maybe it's time to bring your

Re: [Tutor] how can i use python 2 alongside 3?

2013-01-24 Thread Dave Angel
On 01/24/2013 01:26 PM, Matthew Ngaha wrote: yes the 2nd option (standalone pylauncher) sounds more convienient for me. i just have to try and comprehend all the instructions given.. hopefully ill get there in the end i managed to install the laucher. on the site when i click the correct launch

Re: [Tutor] how can i use python 2 alongside 3?

2013-01-24 Thread Dave Angel
On 01/24/2013 01:56 PM, Matthew Ngaha wrote: Have you added shebang lines to those scripts yet? yes i added them. i think the problem is at the start where it asks me to: You should ensure the launcher is on your PATH - depending on how it was installed it may already be there, but check just

Re: [Tutor] Python Help

2013-01-26 Thread Dave Angel
On 01/23/2013 04:37 PM, Grady Trexler wrote: Below is my code. I am using python 2.4 It tells me I have a syntax error. I don't see any such thing. Plesae include the traceback, which will indicate WHERE you have a syntax error. And if you look yourself, you'll probably spot it, since it's

Re: [Tutor] Facebook login using python

2013-01-28 Thread Dave Angel
On 01/28/2013 10:40 AM, Aaron Misquith wrote: I am working on a program which is used to login to facebook, get my friend lists using graph api and export them into pdf format. So far i'm able to login with facebook and get the friend list. I would like if someone is able to provide me a code to

<    9   10   11   12   13   14   15   16   17   18   >