Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Marc Tompkins
On Mon, May 13, 2013 at 4:01 PM, Daniel Magruder wrote: > Dear Dave, > I am using python 2. > I am still confused as what return does. What does it mean if a function > returns True to the caller? What is the caller? > You've defined a function - isodd - but it doesn't automatically execute. It

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Marc Tompkins
On Mon, May 13, 2013 at 5:13 PM, Marc Tompkins wrote: > In fact, you could shorten your isodd() function to: > > def isodd(candidate): > >return candidate%2 !=0: > and it would function identically. > Sorry - that should be > def isodd(candidate): >

Re: [Tutor] Making a Primary Number List generator

2013-05-14 Thread Marc Tompkins
On Tue, May 14, 2013 at 1:51 AM, Alan Gauld wrote: > On 14/05/13 00:01, Daniel Magruder wrote: > > I am still confused as what return does. >> > > This isn't a direct response to Alan, but to something the OP expressed many, many messages ago... The OP expressed some confusion between what a fun

Re: [Tutor] Making a Primary Number List generator

2013-05-15 Thread Marc Tompkins
On Wed, May 15, 2013 at 2:26 AM, Steven D'Aprano wrote: I assumed Marc was talking hypothetically. A print function *could* > return a result, even if Python's print function does not. > > Actually, I was mixing up my memory of an overloaded print() function with Python's built-in print(). I _hav

Re: [Tutor] Making a Primary Number List generator

2013-05-15 Thread Marc Tompkins
On Wed, May 15, 2013 at 1:02 PM, Alan Gauld wrote: > On 15/05/13 16:51, Marc Tompkins wrote: > > Actually, I was mixing up my memory of an overloaded print() function >> > > And C's printf() returns the number of chars printed. > I actually wish python had follow

Re: [Tutor] Making a Primary Number List generator

2013-05-15 Thread Marc Tompkins
On Wed, May 15, 2013 at 3:43 PM, Oscar Benjamin wrote: > On 15 May 2013 22:21, Marc Tompkins wrote: > > On Wed, May 15, 2013 at 1:02 PM, Alan Gauld > > wrote: > >> > >> And C's printf() returns the number of chars printed. > >> I actually wish

Re: [Tutor] Making a Primary Number List generator

2013-05-15 Thread Marc Tompkins
On Wed, May 15, 2013 at 3:52 PM, Marc Tompkins wrote: > I was thinking along the lines of an optional parameter ("verbose" or > something similar), so print() would supply a return value if you asked it > to but keep stumm if you didn't. > After I hit Send, I tho

Re: [Tutor] Making a Primary Number List generator

2013-05-15 Thread Marc Tompkins
On Wed, May 15, 2013 at 4:14 PM, Oscar Benjamin wrote: > I don't really understand what the reason for having the information > is. Would it return the number of characters written or the number of > bytes? > It's absolutely useless in an interactive session, or any time that print() is printing

Re: [Tutor] Making a Primary Number List generator

2013-05-15 Thread Marc Tompkins
On Wed, May 15, 2013 at 5:07 PM, Steven D'Aprano wrote: > Guido's time machine strikes again. > > > py> import sys > py> sys.stdout.write('NOBODY expects the Spanish Inquisition!\n') > NOBODY expects the Spanish Inquisition! > 40 > > > The write() method of file objects in Python 3 return the num

Re: [Tutor] Word Jumble - Chpt4 (Explanation)

2013-05-16 Thread Marc Tompkins
On Thu, May 16, 2013 at 1:03 PM, Arvind Virk wrote: import random > > WORDS = ('python','jumble','easy','difficult','lower','high') > word = random.choice(WORDS) > correct = word > jumble = "" > > while word: > position = random.randrange(len(word)) > jumble += word[position] > word =

Re: [Tutor] Python Idle Crashing

2013-05-17 Thread Marc Tompkins
On Fri, May 17, 2013 at 12:35 PM, Prasad, Ramit wrote: > Forwarding to the list as I believe the reply was mistakenly sent only to > me. > Grr. Sorry about that! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

Re: [Tutor] try..except - what about that ton of **Error statements?

2013-05-22 Thread Marc Tompkins
On Tue, May 21, 2013 at 11:25 PM, Bod Soutar wrote: > On 22 May 2013 07:20, Jim Mooney wrote: > >> Keep the try block small. For example if it's for a call to > >> open(filename, "r") the only possible errors (assuming correct syntax) > >> are NameError for using an undefined variable and IOErro

Re: [Tutor] try..except - what about that ton of **Error statements?

2013-05-22 Thread Marc Tompkins
On Wed, May 22, 2013 at 9:50 AM, boB Stepp wrote: > I guess I'll pick the first alternative. However, this brings to mind > my biggest gripe as a user of software, particularly here at work > where the programmer obviously has no medical background: cryptic > error messages that might be meaningf

Re: [Tutor] keyboard interrupt

2013-05-22 Thread Marc Tompkins
On Wed, May 22, 2013 at 12:47 PM, Jim Mooney wrote: > I made a simple ear frequency-tester, but I don't want it to go on > forever, so I tried stopping it when I pressed a key, as below, but > that doesn't work. I did check out keyboard interrupts but they seem > unnecessarily complex just to sto

Re: [Tutor] keyboard interrupt

2013-05-22 Thread Marc Tompkins
On Wed, May 22, 2013 at 1:30 PM, Jim Mooney wrote: > On 22 May 2013 13:24, Jim Mooney wrote: > >> I've not used it myself, but I believe the KeyboadInterrupt is only > >> generated by one _specific_ keypress. You mentioned that you pressed a > key > >> - did you try Control-C? > > > > Actually,

Re: [Tutor] keyboard interrupt

2013-05-24 Thread Marc Tompkins
On Thu, May 23, 2013 at 3:52 PM, Steven D'Aprano wrote: > On 24/05/13 06:37, Jim Mooney wrote: > >> Apparently Wing isn't as savvy as IDLE when it comes to communicating >>> with the subprocess. I've only searched for about a minute, but >>> apparently the way this works in Wing is to "Restart She

Re: [Tutor] keyboard interrupt

2013-05-26 Thread Marc Tompkins
On Fri, May 24, 2013 at 7:19 PM, Steven D'Aprano wrote: You can edit *other* people's questions and answers??!??!?? > > What. The. Hell. The idea is to build an authoritative information resource (in particular, the goal is that the accepted answer to any given question will become the primary r

Re: [Tutor] keyboard interrupt

2013-05-26 Thread Marc Tompkins
On Sun, May 26, 2013 at 6:17 AM, eryksun wrote: > On Sun, May 26, 2013 at 4:34 AM, Steven D'Aprano > wrote: > > > > So these edits aren't default-deny, but default-accept? Worse and worse. > > It shows who made the edit and when they edited it, which links to the > revision history. When a quest

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Marc Tompkins
On Sun, Jun 2, 2013 at 9:56 AM, Jim Mooney wrote: > I still sometimes type input instead of that annoying raw_input and get a > weird error. Here's a nifty tip to get around that - and to eliminate one more thing you'd have to change later, if you switch back to 3. Put this near the top of yo

Re: [Tutor] recursion surprise

2013-06-08 Thread Marc Tompkins
On Sat, Jun 8, 2013 at 4:52 PM, Jim Mooney wrote: > Well, I thought > > if num > 10: > return num > > Was a return statement. Num does become > 10. You mean I need more than > one? > It is, and you actually have more than one. All functions return None, unless you explicitly spec

Re: [Tutor] Value Error

2013-06-12 Thread Marc Tompkins
On Wed, Jun 12, 2013 at 3:31 PM, Dave Angel wrote: > >>> cmath.sqrt(float((math.e **(i * math.pi)).real)) > 1j > Sh*t just got real. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/li

Re: [Tutor] unstring

2013-06-18 Thread Marc Tompkins
On Tue, Jun 18, 2013 at 6:41 PM, Jim Mooney wrote: > Is there a way to unstring something? That is str(object) will give me > a string, but what if I want the original object back, for some > purpose, without a lot of foofaraw? > Unless you're storing them in a dictionary and the string is the ke

Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Marc Tompkins
On Mon, Jun 24, 2013 at 3:48 PM, Matt D wrote: > > def __init__(self, data): > > wx.PyEvent.__init__(self) > > # this line *binds* this class to a certain type of event, > > wxDATA_EVENT > > self.SetEventType (wxDATA_EVENT) > > # and this is the actual data >

Re: [Tutor] Need help printing a pickled data

2013-06-25 Thread Marc Tompkins
On Tue, Jun 25, 2013 at 6:12 PM, Steven D'Aprano wrote: > Why do you want to see rubbish like that inside your log file? Surely > something like this is better? > > log.write("data = %r" % data) > > which will give you a line like this: > > data = {'a': None, 'b': 42} > > > in your log, which is

Re: [Tutor] Repeat Until Dead

2013-06-26 Thread Marc Tompkins
On Wed, Jun 26, 2013 at 11:23 AM, Jack Little wrote: > In a combat system, how would I have a certain raw_input repeat until the > enemy is dead? > Sounds like a classic case for a "while" loop. ___ Tutor maillist - Tutor@python.org To unsubscribe or c

Re: [Tutor] Typing 'h', 'e', 'l', 'p', 'Enter' in a window

2013-06-26 Thread Marc Tompkins
On Wed, Jun 26, 2013 at 1:45 PM, kdarroud wrote: > In our Windows machine, we have several windows open. > Using Python, how can I type 'h', 'e', 'l', 'p', 'Enter' in a specific > window that is open? > In general, Python out-of-the-box doesn't know about OS-specific things like interacting with

Re: [Tutor] Saving Progress

2013-07-04 Thread Marc Tompkins
On Thu, Jul 4, 2013 at 12:25 AM, Dave Angel wrote: > On 06/27/2013 11:16 AM, Jack Little wrote: > >> Is there a way to save a players progress in a game using python without >> any modules >> >> Jack >> >> > If you organize the game in such a way that a relatively few variables > holds the state,

Re: [Tutor] custom error classes: how many of them does one need?

2013-07-08 Thread Marc Tompkins
On Mon, Jul 8, 2013 at 1:51 PM, Albert-Jan Roskam wrote: > haha, I hadn't even noticed the 'speling eror'. I was just thinking 'what > the heck is a desert spoon'? ;-) > Many years ago, I saw this painted on the side of a pie shop: "My favorite people are the people of the dessert", said Lawrenc

Re: [Tutor] converting string to text

2013-07-10 Thread Marc Tompkins
On Wed, Jul 10, 2013 at 3:45 AM, Dave Angel wrote: > > Get rid of the BOM from the data file, and it'll work fine. You don't > specify what version of Python you're using, so I have to guess. But > there's a utf-8 BOM conversion of a BOM at the beginning of that file, and > that's not numeric.

Re: [Tutor] Reading numbers from a text file

2013-07-10 Thread Marc Tompkins
On Wed, Jul 10, 2013 at 1:41 AM, Phil wrote: > Thank you for reading this. > > Kububtu 13.04 Python 3 > > I'm attempting to read a configuration file that will restore my program > to the state that it was in when it was closed. Ideally the config file > would be human readable. > > Python actual

Re: [Tutor] New Python 3.3.2 Install Fails to Start-Up

2013-07-10 Thread Marc Tompkins
On Wed, Jul 10, 2013 at 10:27 AM, Alan Gauld wrote: > On 08/07/13 06:43, Nathan Schlaffer wrote: > > Second, I tried to run my Python programs today via IDLE but when I >> checked the Edit Menu I couldn't find a Run Menu >> > > IDLE has two modes: Shell and Edit. Shell mode is an interactive P

Re: [Tutor] A slight bug in IDLE

2013-07-14 Thread Marc Tompkins
On Sun, Jul 14, 2013 at 4:18 PM, Jim Mooney wrote: > I prefer import antigravity , but then I lose the rest of the day ;') > Pretty sure that comes from sampling everything in the medicine cabinet for comparison... ___ Tutor maillist - Tutor@python.o

Re: [Tutor] A slight bug in IDLE

2013-07-15 Thread Marc Tompkins
On Sun, Jul 14, 2013 at 7:38 PM, Jim Mooney wrote: > I am seriously considering the subway tour of North America: > http://xkcd.com/1196/large/ > I rather like the Anagram Tube Map: http://www.anagramtubemap.pwp.blueyonder.co.uk/ ___ Tutor maillist -

Re: [Tutor] slashes in paths

2013-07-21 Thread Marc Tompkins
On Sat, Jul 20, 2013 at 4:37 PM, Jim Mooney wrote: > If only Bill Gates hadn't chosen '\', which is awkward to type and > hard to make compatible - but I think he figured his wonderful DOS > would be a Unix-killer, reign supreme, and there would be no > compatibility problem. All I can say to tha

Re: [Tutor] slashes in paths

2013-07-21 Thread Marc Tompkins
On Sun, Jul 21, 2013 at 7:41 PM, Jim Mooney wrote: > On 21 July 2013 18:18, Marc Tompkins wrote: > > > But back in the late 1970s, no way in Hell did Gates see Linux on the > > horizon. He saw CP/M, and the choices that he (and MS in general) made > at > > th

Re: [Tutor] slashes in paths

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 10:47 AM, Jim Mooney wrote: I forgot about TREE. But figured piping C:\Python27>tree /f > pytree.txt > might be illuminating. I piped since it took forever to print because I > have python(x,y). Unfortunately, I got tiny numbers and A with umlauts > instead of the nice path

Re: [Tutor] slashes in paths

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 11:30 AM, Jim Mooney wrote: > On 22 July 2013 11:26, Marc Tompkins wrote: > >> >> >> >> If you haven't already read it, may I suggest Joel's intro to Unicode? >> http://www.joelonsoftware.com/articles/Unicode.html >>

Re: [Tutor] slashes in paths

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 11:57 AM, Jim Mooney wrote: > I had a bad feeling I'd end up learning Unicode ;') > >> >> >> It's not as painful as you might think! Try it - you'll like it! >> Actually, once you start getting used to working in Unicode by default, >> having to deal with programs that are

Re: [Tutor] close, but no cigar

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 11:27 AM, Jim Mooney wrote: > Okay, I'm getting there, but this should be translating A umlaut to an old > DOS box character, according to my ASCII table, but instead it's print > small 'u': > > def main(): > zark = '' > for x in "ÀÄÄÄ": > print(unichr(ord(u

Re: [Tutor] close, but no cigar

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 1:55 PM, Jim Mooney wrote: > On 22 July 2013 13:45, Marc Tompkins wrote: > >> >> inFileName = "/Users/Marc/Desktop/rsp/tree.txt" >> with open(inFileName, 'r') as inFile: >> inString = inFile.read().decode(

Re: [Tutor] slashes in paths

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 2:00 PM, Jim Mooney wrote: > so I should just walk the python27 tree and write my own box drawing > chars? Or is there a more global alternative to DOS box-drawing chars to > illustrate a tree structure, other than graphic processing? > You could do worse... Again, my is

Re: [Tutor] slashes in paths

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 2:34 PM, eryksun wrote: > > Just to clarify, tree isn't completely Unicode naive. It writes > Unicode to the console, presuming you're using a font that supports > it, such as Consolas. > Interesting! Indeed - I just moved my test Cyrillic file to a different folder (so

Re: [Tutor] close, but no cigar

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 3:22 PM, Jim Mooney wrote: > On 22 July 2013 14:11, Marc Tompkins wrote: > >> >> One way to deal with this is to specify an encoding: >> newchar = char.decode('cp437').encode('utf-8') >> > > Works fine, but I

Re: [Tutor] close, but no cigar

2013-07-22 Thread Marc Tompkins
On Mon, Jul 22, 2013 at 6:13 PM, Dave Angel wrote: > On 07/22/2013 02:27 PM, Jim Mooney wrote: > >> Okay, I'm getting there, but this should be translating A umlaut to an old >> DOS box character, according to my ASCII table, but instead it's print >> small 'u': >> >> def main(): >> zark = '

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

2013-07-23 Thread Marc Tompkins
On Tue, Jul 23, 2013 at 12: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

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

2013-07-23 Thread Marc Tompkins
On Tue, Jul 23, 2013 at 1:13 AM, Marc Tompkins wrote: > As an experiment, I added a couple of extra methods and attributes to the > Kronk class, but it didn't change anything - IDs still incremented by 40 > each time. eryksun will no doubt chime in to tell us exactly how ob

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

2013-07-23 Thread Marc Tompkins
On Tue, Jul 23, 2013 at 1:17 AM, Jim Mooney wrote: > On 23 July 2013 00:40, Steven D'Aprano wrote: > >> >> No no no, a thousand times no!!! IDs are just numeric IDs, that is all, >> like your social security number or driver's licence number. Don't think of >> them as having any meaning at all, e

Re: [Tutor] close, but no cigar

2013-07-23 Thread Marc Tompkins
On Tue, Jul 23, 2013 at 7:46 AM, Steven D'Aprano wrote: > This is not quite as silly as saying that an English E, a German E and a > French E should be considered three distinct characters, but (in my > opinion) not far off it. > I half-agree, half-disagree. It's true that the letter "E" is used

Re: [Tutor] unichr not working as expected

2013-07-23 Thread Marc Tompkins
On Tue, Jul 23, 2013 at 12:31 PM, Dave Angel wrote: > The three distributed version control systems I know of are: >git, mercurial, and bazaar > Not to overplay my Joel Spolsky fanboiism, but are you aware of Kiln from Fog Creek? It started out as an enterprise-friendly wrapper around Mercu

Re: [Tutor] Can anyone explain this

2013-08-07 Thread Marc Tompkins
On Fri, Aug 2, 2013 at 4:33 PM, Amandeep Behl wrote: > Can anyone explain this code below: > > > import sys > import os > > if __name__ == '__main__': > sys.path.insert(0, "..") > else: > sys.path.insert(0, os.path.join( > os.path.split(__file__)[0], '..')) > When you run this

Re: [Tutor] How to access a method defined in one class from another class (which is a thread) in Python3?

2013-08-08 Thread Marc Tompkins
On Thu, Aug 8, 2013 at 7:15 PM, Joel Goldstick wrote: > On Thu, Aug 8, 2013 at 9:52 PM, SM wrote: > > > > > OP is me? Not sure what it stands for, but I am a 'she' :) > > FYI (For you information) OP means Original Poster. Although people > do refer to names in replies here, the term OP is used

Re: [Tutor] dbus.Array to string

2013-08-13 Thread Marc Tompkins
On Tue, Aug 13, 2013 at 8:59 AM, Amit Saha wrote: > What does it mean (and will it always work?) when I don't specify any > encoding: > > >>> bytearray(ssid).decode() > u'BigPond679D85' > If you don't specify an encoding, then the default encoding is used; as you point out a bit later, your loc

Re: [Tutor] To find the least number divisible by all numbers from 1-20

2013-08-13 Thread Marc Tompkins
On Tue, Aug 13, 2013 at 9:45 AM, #PATHANGI JANARDHANAN JATINSHRAVAN# < jatinshr...@e.ntu.edu.sg> wrote: > Hello All, > > Sorry for the earlier mail without subject. I was in a hurry so I missed > that > > I am solving problem number 5 in project euler. I think my solution > seems logically corre

Re: [Tutor] class data member and objects of class in python

2013-09-11 Thread Marc Tompkins
On Wed, Sep 11, 2013 at 5:40 AM, zubair alam wrote: > i am learning how a __class__ data member behaves in python as compared to > static data member in java, but following code is throwing error > > > class PizzaShop(): > pizza_stock = 10 > def get_pizza(self): > while not PizzaSh

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread Marc Tompkins
On Thu, Oct 24, 2013 at 11:25 AM, bob gailer wrote: > On 10/24/2013 2:09 PM, Danny Yoo wrote: > >> Related: I saw a picture the other day on Google+ of an mailing envelope >> whose zip code was written in scientific notation. >> > That;s odd - since ZIP codes are character, not integer, > You'd

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread Marc Tompkins
On Thu, Oct 24, 2013 at 1:21 PM, Marc Tompkins wrote: > On Thu, Oct 24, 2013 at 11:25 AM, bob gailer wrote: > >> On 10/24/2013 2:09 PM, Danny Yoo wrote: >> >>> Related: I saw a picture the other day on Google+ of an mailing envelope >>> whose zip cod

Re: [Tutor] Finding a nearest perfect cube

2013-11-07 Thread Marc Tompkins
On Thu, Nov 7, 2013 at 2:25 PM, donsuni wrote: > Hi, I am new to python and i have to write a following code without using > any > inbuilt function or a for loop. Only while and if loops are allowed. > > If i input a number, i should get a perfect cube nearest to it. > For eg: if > input=4, outpu

Re: [Tutor] Issue w/ while loops

2013-11-23 Thread Marc Tompkins
On Sat, Nov 23, 2013 at 8:30 AM, Rafael Knuth wrote: > Marc, > > great feedback - thank you very much! > I will bear that in mind for the future. > > I modified my program as you suggested, but I received a runtime > error; I tried to fix that but unfortunately I didn't succeed. > The modified pro

Re: [Tutor] What is a namespace? What is meant by "A namespace is a mapping from names to objects"

2013-12-09 Thread Marc Tompkins
On Sun, Dec 8, 2013 at 8:46 PM, Varuna Seneviratna < varunasenevira...@gmail.com> wrote: > But what is meant by "A *namespace* is a mapping from names to objects" > Steven touched on this, but I'd like to emphasize: in Python, EVERYTHING is an object - variables, functions, integers, strings, you

Re: [Tutor] Stuck on error

2013-12-21 Thread Marc Tompkins
On Sat, Dec 21, 2013 at 12:36 PM, NZHacker1 . wrote: > I'm not finished with the program and I put Plays = int(x) * 100, > plays = int(x) * 100 > on purpose. > > I don't think you understood what people were trying to tell you. Python is case-sensitive; "plays" and "Plays" are NOT the same vari

Re: [Tutor] Which computer operating system is best for Python

2014-02-05 Thread Marc Tompkins
On Wed, Feb 5, 2014 at 3:18 PM, Joel Goldstick wrote: > I would get a laptop with as large a screen as you can afford. Windows or > Linux. > > I second that emotion, and also: try out the keyboard first (or rather, have your kid try it out). We spend a lot of time on our laptops, and a badly-desi

Re: [Tutor] PyCountry currency formatting woes

2014-05-04 Thread Marc Tompkins
On Sun, May 4, 2014 at 1:55 PM, Sithembewena Lloyd Dube wrote: > Thanks, i was actually getting the error information to update the post. > Apoligies to waste your time posting here - I could not find an appropriate > PyCountry discussion list and my next best bet seemed to be a Python users' > li

Re: [Tutor] substituting for time_series, Pandas, Anaconda. Practical Programming, intro Comp Sci, Gries text

2014-05-14 Thread Marc Tompkins
On Wed, May 14, 2014 at 12:08 PM, Charles Agriesti wrote: > Is this Anaconda thing any part of being able to run the scripts from the > textbook with time_series? Is it a complete wild goose chase? > First off - I know nothing about using Python in a scientific setting. Second (before anyone el

Re: [Tutor] what is the cores?

2014-05-25 Thread Marc Tompkins
On Sun, May 25, 2014 at 10:32 AM, Marino David wrote: > Hi all: > I am a newpie at python. > I read a python toolbox in which there is code line:import cores as co. I > wantta know what the cores is. > When I type "import cores as co", error occur as follows: > Traceback (most recent call last): >

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-27 Thread Marc Tompkins
On Tue, May 27, 2014 at 12:27 PM, Degreat Yartey wrote: > I am studying python on my own (i.e. i am between the beginner and > intermediate level) and i haven't met any difficulty until i reached the > topic 'Generators and Iterators'. > I need an explanation so simple as using the expression 'pri

Re: [Tutor] Library for .ppt to .txt conversion

2014-05-30 Thread Marc Tompkins
On Fri, May 30, 2014 at 2:41 AM, Aaron Misquith wrote: > Like pypdf is used to convert pdf to text; is there any library that is > used in converting .ppt files to .txt? Even some sample programs will be > helpful. > I suspect you'd need to use PowerPoint itself to do that cleanly; you can defin

Re: [Tutor] self keyword in recursive function

2014-05-30 Thread Marc Tompkins
On Fri, May 30, 2014 at 10:16 PM, Ritwik Raghav wrote: > It has again given some error I do not understand. This time my code is: > > count = 0 > def getPersistence(self,n): > > product = 1 > if len(str(n)) == 1: > return self.count > else: > a = str(n) > for

Re: [Tutor] self keyword in recursive function

2014-05-30 Thread Marc Tompkins
On Fri, May 30, 2014 at 11:06 PM, Ritwik Raghav wrote: > That's all the code I'm writing. > That can't be true - the 11 lines of code you posted doesn't include anything that would give you "Correct Return Value: No", let alone any reference to PersistentNumber. From the error message, it would

Re: [Tutor] Swampy: No module name World

2014-06-03 Thread Marc Tompkins
On Tue, Jun 3, 2014 at 7:53 AM, Charles Agriesti wrote: > Thanks all. Problem apparently solved. Shortly after that last message it > quit working completely. Reinstall Python 2.7 + swampy -> no good; > uninstall both 2.7 and 3.4, manually remove the folders that remained > because of scripts tha

Re: [Tutor] Swampy: No module name World

2014-06-03 Thread Marc Tompkins
On Tue, Jun 3, 2014 at 11:00 AM, Mark Lawrence wrote: pip-win (https://sites.google.com/site/pydatalog/python/pip-for-windows) > > > Never heard of it so thanks for the link. > > I don't know how long it's been around but I'll tell you this much for free: I wish I'd known about it when I first s

Re: [Tutor] Simple python help

2014-06-10 Thread Marc Tompkins
On Tue, Jun 10, 2014 at 7:55 AM, Stephen Brazil wrote: > Hello! I am brand new to python and need to know how to make the attached > lines of code work. Should be pretty > You need quotes. Stephen (without quotes) is an object, which you haven't previously defined. 'Stephen' is a string, whic

Re: [Tutor] python sockets

2014-06-10 Thread Marc Tompkins
On Tue, Jun 10, 2014 at 9:28 AM, Jon Engle wrote: > for port in range (startingPort, 65535): > thread.start_new_thread(setup, (port,)) > startingPort=startingPort+1 > #print startingPort > I think you just need this: for port in range (startingPort, 65535): > thread.start_new_thread(s

Re: [Tutor] python sockets

2014-06-10 Thread Marc Tompkins
On Tue, Jun 10, 2014 at 2:00 PM, Jon Engle wrote: > Ok, so after making the changes the code does bind the startingPort > variable but that is the only port that gets bound. Also when connecting to > the startingPort I receive the following error: > > Please enter starting port: 65520 > >

Re: [Tutor] python sockets

2014-06-11 Thread Marc Tompkins
On Tue, Jun 10, 2014 at 4:08 PM, Jon Engle wrote: > Ok, so when I run the code it immediately terminates and never 'listens' to > the ports in the loop. I have verified by running netstat -an | grep 65530 > and the startingPort is not binding. The problem is that all threads started by a program

Re: [Tutor] How to list/process files with identical character strings

2014-06-24 Thread Marc Tompkins
On Tue, Jun 24, 2014 at 8:34 AM, mark murphy wrote: > What I hope to be able to do is scan the directory, and for each instance > where there are two files where the first 8 characters (TDDD) are > identical, run a process on those two files and place the output (named > TDDD) in a new

Re: [Tutor] How to list/process files with identical character strings

2014-06-24 Thread Marc Tompkins
On Tue, Jun 24, 2014 at 1:02 PM, Peter Otten <__pete...@web.de> wrote: > Sorting is probably the approach that is easiest to understand, but an > alternative would be to put the files into a dict that maps the 8-char > prefix to a list of files with that prefix: > I was debating the virtues of th

Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread Marc Tompkins
On Sun, Jul 6, 2014 at 1:57 PM, Danny Yoo wrote: > 2. Direct feedback to the Python web site maintainers so that either they fix the problem or are at least aware that something is deficient. Google offers a per-site custom search; it's free for very basic functionality and not very expensive

Re: [Tutor] Using module Facebook

2014-07-18 Thread Marc Tompkins
On Fri, Jul 18, 2014 at 9:29 AM, Chris wrote: > On 07/18/2014 09:44 AM, Alan Gauld wrote: > > Are you sure thats the version of Python you are running > > in the virtualenv? > > I've modified the first line to #!./bin/python (instead of > #!/usr/bin/python). > > Now, there's another error message

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 8:40 AM, LN A-go-go wrote: > > States OJ > AK 36 > AL 39 > AR 39 > AZ 45 > CA 61 > CO 54 > CT 61 > DC 93 > DE 62 > FL 51 > GA 47 > HI 72 > IA 54 > ID 36 > IL 62 > IN 50 > KS 41 > KY 41 > LA 40 > MA 62 > MD 62 > ME 58 > MI 57 > MN 54 > MO 49 > MS 43 > MT 47 > NC 50 > ND 45

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 2:37 PM, Alan Gauld wrote: > In fact in this case I suggested he use a for loop to iterate over > the file and use a dictionary to store the results... Ah. I missed that, as I've only noticed this newer thread. And I apologize for imputing motive (a liking for "while Tr

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 6:12 PM, Mark Lawrence wrote: >> Ah. I missed that, as I've only noticed this newer thread. And I >> apologize for imputing motive (a liking for "while True"); I'd just >> noticed that you often advise it. I don't know who _does_ think this >> is a desirable pattern; I'

Re: [Tutor] Ending a loop with a condition not at the top

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 8:10 PM, Ben Finney wrote: > Marc Tompkins writes: > >> Seriously, though, how is >> 1) Do {this} forever, until something happens that I'll tell you about >> later >> >> better than >> 2) Do {this} until this condition, wh

Re: [Tutor] Comparing two different text file

2014-07-29 Thread Marc Tompkins
On Tue, Jul 29, 2014 at 4:13 PM, 이명교 wrote: > inf1 = open('first.txt') > for line in inf1.readlines(): > list1.append(line) So far, so good... > list1 = line[:-1].split('\n') ...but then you do this, which wipes out list1. > for a in list1: > if a not in list1: Even if you hadn't

Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Marc Tompkins
On Tue, Aug 5, 2014 at 12:48 AM, Maxime Steisel wrote: > I think this is because on windows, *.py files are associated with py.exe > that choose the python version depending on the first line of your file. No. *ix operating systems (Unix, Linux, OS X, etc.) inspect the first line of a file to de

Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Marc Tompkins
On Tue, Aug 5, 2014 at 8:23 AM, Zachary Ware wrote: > > which it should be if the most recently > installed Python was 3.3 or 3.4, installed with default options. > And there we have my problem with this glorious new "feature". YOU CAN'T RELY ON IT, because it depends on the most recent version

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-15 Thread Marc Tompkins
On Fri, Aug 15, 2014 at 10:46 AM, Terry--gmail wrote: (By the way - your indentation got flattened - cue the inevitable chorus of "DON'T POST TO THIS LIST IN HTML" - so this is my best-guess reconstruction.) > lens = [] > # pre-format the list called lens for maximum number of columns contained i

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-17 Thread Marc Tompkins
On Sun, Aug 17, 2014 at 4:48 PM, Terry--gmail wrote: > WOW! There is a lot of help on this mailing list! I want to thank everyone > for their valuable input! Thanks! (I am working my way through the > replies.) > > Sorry about the HTML. I think I have it turned off now in Thunderbirdy for > this

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-17 Thread Marc Tompkins
On Sun, Aug 17, 2014 at 9:40 PM, Terry--gmail wrote: > I found another place in Thunderbirdy to set 'plain text'. > > This is a test. > > Does the below code look correct now? > > --And did I reply correctly this time? (Reply-All and keep only > tutor@python.org address...) > > > for line_number,

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-17 Thread Marc Tompkins
On Sun, Aug 17, 2014 at 9:49 PM, Marc Tompkins wrote: > On Sun, Aug 17, 2014 at 9:40 PM, Terry--gmail > wrote: >> I found another place in Thunderbirdy to set 'plain text'. >> >> This is a test. >> >> Does the below code look correct now? >> &

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-18 Thread Marc Tompkins
On Sun, Aug 17, 2014 at 10:51 PM, Terry--gmail wrote: > I'm copy and pasting from Ninja-IDE, which I thought was created > specifically to do python programming... Specifically for programming, yes, and Python is among the supported languages - but according to their web page, they support many l

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-18 Thread Marc Tompkins
On Mon, Aug 18, 2014 at 12:13 AM, Cameron Simpson wrote: > On 17Aug2014 23:51, Terry--gmail wrote: >> >> I'm copy and pasting from Ninja-IDE, which I thought was created >> specifically to do python programming...so I never checked to see if it >> needs to have the tab set to enter 4 spaces, as i

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-19 Thread Marc Tompkins
On Mon, Aug 18, 2014 at 1:00 AM, Marc Tompkins wrote: > Also, looking at the Ninja-IDE website more closely I see that, > although they do mention compatibility with multiple languages, they > were designed by and for Python programmers - which makes the > tab/space issue less like

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-19 Thread Marc Tompkins
On Tue, Aug 19, 2014 at 1:04 PM, Mark Lawrence wrote: > I'm not aware of any problem with Thunderbird or any (semi-)decent mail > client. The original poster uses NinjaIDE and Thunderbird, and his code was being persistently flattened when he copied/pasted. I believe I've just tracked it down to

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-20 Thread Marc Tompkins
On Aug 20, 2014 12:07 PM, "Terry--gmail" wrote: > > Alan Gauld > > Hi! > We are not quite out of the woods on this last example you gave me. It now seems to be complaining > that it doesn't want to append an integer to the list or that this isn't the place to use '.append' -- I am probably interp

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-20 Thread Marc Tompkins
On Wed, Aug 20, 2014 at 1:38 PM, Terry--gmail wrote: > Marc, my understanding is, is that: > > lens[col].append(len(item)) > > -should be building a mirror image of my list of lists called catalog2, > which currently has 9 columns by x number of rows, and that we are plugging > into these posi

Re: [Tutor] Using unittest module for Test Driven Development

2014-08-25 Thread Marc Tompkins
On Mon, Aug 25, 2014 at 12:04 AM, Alex Kleider wrote: > I appreciate your further elucidation, like your 'sledge hammer' metaphor and > thank you for the fragility warning. I expect within such a limited scope, > the dangers are not great. As someone who has been burned by this sort of thinkin

Re: [Tutor] Tutor Digest, Vol 127, Issue 12

2014-09-04 Thread Marc Tompkins
On Thu, Sep 4, 2014 at 3:26 PM, Alan Gauld wrote: > On 04/09/14 21:37, Najam Qasim wrote: >> I downloaded notepad++. Can you please help me how to run python script in >> notepad++? > > I only played with notepad++ briefly but I seem to recall it had a menu with > commands to 'make' and 'run' a fi

Re: [Tutor] How to count vehicle? I'm trying but my code don't increasing..

2014-09-05 Thread Marc Tompkins
On Fri, Sep 5, 2014 at 4:09 AM, Whees Northbee wrote: > I'm really sorry if my post doesn't appropriate to the forum rule.. I > already asked in other forums 2 months ago, but no answer or had voted down > and closed.. It's not that you've broken a rule. It's just that you're asking on a forum w

Re: [Tutor] Vol 127, Issue 15

2014-09-05 Thread Marc Tompkins
On Fri, Sep 5, 2014 at 2:32 PM, Crush wrote: > Ok nevermind, I did not figure it out. My code... > > count = 0 > while count < 3: > count += 1 > Subprocess.Popen('command') > if count == 3: > sys.exit() > > This does not work as I want it to; it consecutively executes the command > t

Re: [Tutor] Auto-response for your message to the "Tutor" mailing list

2014-10-26 Thread Marc Tompkins
On Sun, Oct 26, 2014 at 1:15 PM, Danny Yoo wrote: > > >> why is it I get this messages repeatedly despite having been reading > and writing on the list for over a year now? > > This has happened to me once in a while too. I conjecture that it might > be a bug with Mailman, but I'd have to dive i

<    1   2   3   4   5   >