Re: [Tutor] recursion depth

2014-01-09 Thread Dave Angel
On Thu, 9 Jan 2014 21:41:41 +1100, Steven D'Aprano wrote: I presume that your question is aimed at Keith. Yes, Keith's emails have a HTML part and a text part. A half-decent mail client should be able to read the text part even if the HTML part exists. But I believe you're reading this fro

Re: [Tutor] recursion depth

2014-01-09 Thread Dave Angel
On Thu, 9 Jan 2014 13:02:30 -0500, Keith Winston wrote: Well, hopefully this is plain text. It all looks the same to me, so if gmail switches back, it might go unnoticed for a while. Sorry for the incessant hassle. That looks great, thanks. -- DaveA _

Re: [Tutor] lambdas, generators, and the like

2014-01-12 Thread Dave Angel
Keith Winston Wrote in message: > I've got this line: > > for k in range(len(tcombo)): > tcombo_ep.append(list(combinations(tcombo, k+1))) > > generating every possible length combination of tcombo. I then test > them, and throw most of them away. I need to do this differently, it > gets wa

Re: [Tutor] another better way to do this ?

2014-01-12 Thread Dave Angel
Roelof Wobben Wrote in message: That documentation says nothing about order. And the test cases specifically contradict it. so try if set (b) <= set (a): -- DaveA Android NewsGroup Reader http://www.piaohong.tk/newsgroup ___ Tutor ma

Re: [Tutor] Euler Spoiler

2014-01-12 Thread Dave Angel
Keith Winston Wrote in message: > I'm working through some of the Project Euler problems, and the > following might spoil one of the problems, so perhaps you don't want > to read further... > > > The problem relates to finding all possible combinations of coins that > equal a given total. I'm b

Re: [Tutor] Interactive escape sequences

2014-01-14 Thread Dave Angel
Alan Gauld Wrote in message: > On 14/01/14 07:42, Christian Alexander wrote: > >> Why does the interactive prompt not recognize escape sequences in >> strings? It only works correctly if I use the print function in python 3. >> >> >>> "Hello\nWorld" >> "Hello\nWorld" > > That depends on how y

Re: [Tutor] Mocking with "mock" in unit testing

2014-01-17 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Fri, Jan 17, 2014 at 08:35:04AM -0500, eryksun wrote: >> On Fri, Jan 17, 2014 at 6:23 AM, Steven D'Aprano wrote: >> > On Fri, Jan 17, 2014 at 09:58:06AM +, James Chapman wrote: > [...] >> >> import mockimport unittestimport pinger >> >> class Test_Ping

Re: [Tutor] Question on os.popen

2014-01-19 Thread Dave Angel
SM Wrote in message: > Sorry for not giving details on the OS and python version I am using: Ubuntu > and Python3 On Sun, Jan 19, 2014 at 8:20 PM, Alan Gauld wrote: On 19/01/14 23:36, SM wrote: >> I read about os.popen in >> http://docs.python.org/2/library/subprocess.html#subprocess.Popen >

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Dave Angel
Adam Hurwitz Wrote in message: > Many times when a function doesn't work, and you can't figure out why, it pays to factor the function, at least temporarily, and test the different parts. This might be your best bet in this case, especially when I tell you that you're very close. I the

Re: [Tutor] How to correct decimal addition.

2014-01-24 Thread Dave Angel
Leon S Wrote in message: > _ (please post in plain text in this text mailing list. Html messes up formatting and causes some newsreaders grief.) .. Leon said: Here is what I'm trying to do, accept a price of gas, but I want to add the .009 to the price, so that people do n

Re: [Tutor] Importing Pygame

2014-01-28 Thread Dave Angel
myles broomes Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > I'm guessing you're attempting to post here in this text newsgroup using h

Re: [Tutor] If, elif, else

2014-01-28 Thread Dave Angel
"Michael L. Pierre" Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > Start by posting in text form, since this is a text group. You appa

Re: [Tutor] Can't figure out why I'm getting no output??

2014-01-28 Thread Dave Angel
scurvy scott Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > Please post as text, not html. Try putting a print at the top of the code.

Re: [Tutor] Installing Python on osx 10.9.1

2014-01-28 Thread Dave Angel
Aubri Sandlin Wrote in message: > I have installed Python. When I open IDLE I get this warning: >>> WARNING: > The version of Tcl/Tk (8.5.9) in use may be unstable. > Visit http://www.python.org/download/mac/tcltk/ for current information. > > > I have downloaded and installed the latest ver

Re: [Tutor] Installing Python on osx 10.9.1

2014-01-28 Thread Dave Angel
Dave Angel Wrote in message: > Aubri Sandlin Wrote in message: >> I have installed Python. When I open IDLE I get this warning: >>> WARNING: >> The version of Tcl/Tk (8.5.9) in use may be unstable. >> Visit http://www.python.org/download/mac/tcltk/ for current

Re: [Tutor] When is = a copy and when is it an alias

2014-01-28 Thread Dave Angel
Denis Heidtmann Wrote in message: > > What is going on?  I am more confused than I was a week ago. Simple. spir has copy/paste editing errors. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https

Re: [Tutor] If, elif, else

2014-01-29 Thread Dave Angel
Steven D'Aprano Wrote in message: > > Sorry Dave, your tools are letting you down again. Michael did in fact > post with plain text. His original email included both a text/plain part > and a text/html part. > > Now I'm no friend of posting in HTML, I think it&

Re: [Tutor] importing my module imports only one function

2014-01-30 Thread Dave Angel
Ian D Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > 1) you forgot to escape the backslashes in your module path. Either use forward sl

Re: [Tutor] Traversing lists or getting the element you want.

2014-02-02 Thread Dave Angel
Kipton Moravec Wrote in message: > I am new to Python, and I do not know how to traverse lists like I > traverse arrays in C. This is my first program other than "Hello World". > I have a Raspberry Pi and they say Python is the language of choice for > that little machine. So I am going to try to

Re: [Tutor] Any ideas

2014-02-04 Thread Dave Angel
josh Malone Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > First thing is to figure your goal. "Model" might mean anything from "figur

Re: [Tutor] input python 3.3

2014-02-04 Thread Dave Angel
Ian D Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > When making an amendment to a post, please reply to that post; don't start a new

Re: [Tutor] My First Post

2014-02-04 Thread Dave Angel
Danny Yoo Wrote in message: > (Sorry if you get this message twice: I think I accidently mis-sent > the message to the wrong address, so to make sure, I'm sending to what > I think is the right address this time.) > > --- > > Hi Premanshu, [deleting useful advice] Welcome to the list. When

Re: [Tutor] sys.path.append import python3 not working

2014-02-05 Thread Dave Angel
Ian D Wrote in message: > > import sys > sys.path.append("d:\modules")   > I have tried it with append("d:\\modules") append("d:/\modules")   The first form is not reasonable, you'd need to double the backslash. But your second try should have worked. Here's what I would use: "d:/modules"

Re: [Tutor] Splitting email headers when using imaplib

2014-02-05 Thread Dave Angel
spir Wrote in message: > > I have no idea of the pattern or structure of email headers. Would you post > some > example of 'msg_header_content[0][1]'? > > In the meantine, try to suppress \r from the regex formats. (Shouldn't be > here, > because when reading strings from files, python con

Re: [Tutor] sys.path.append import python3 not working

2014-02-05 Thread Dave Angel
Ian D Wrote in message: > __ Ok I seem to be having some success with it at the moment after moving > the location of the module. That might be because the letter following the backslash is not currently a valid escape code. You really shouldn't leave half broken code; it tends to break aga

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

2014-02-05 Thread Dave Angel
Steven D'Aprano Wrote in message: > > > > > But still complex. And you're limited by the (lack of) stability of > Windows. > > If you don't *need* Windows, there is no point in running Linux on top > of Windows in a virtual machine. It just means you're using twice as > much memory, and you

Re: [Tutor] learning recursion

2014-02-06 Thread Dave Angel
Denis Heidtmann Wrote in message: > > Please post in text, not html. Your posting program loses the indentation in the text view, which is what most people see. Code: def fib2(n): if n==1: return 1 elif n==2: return 1 else:

Re: [Tutor] learning recursion

2014-02-09 Thread Dave Angel
Russel Winder Wrote in message: > On Thu, 2014-02-06 at 18:06 -0500, Dave Angel wrote: > […] >> >> Code: >> def fib2(n): >> if n==1: >> return 1 >> >> elif n==2: >> return 1 >> else: >&g

Re: [Tutor] Recommendation For A Complete Noob

2014-02-09 Thread Dave Angel
Altrius Wrote in message: > Hi, > > I’m completely new to programming in general and everything I have read so > far has pointed me to Python. I’ll put this another way: All I know is that > a programming language is a medium for a human to tell a computer what to do. > After that I’m k

Re: [Tutor] second if

2014-02-09 Thread Dave Angel
rahmad akbar Wrote in message: Between invisible colors and a tiny font, your message is totally incomprehensible to me. This is a text list, please post in text, not html. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] Python .decode issue

2014-02-09 Thread Dave Angel
james campbell Wrote in message: > (Context lost because message was erroneously posted in html) strings cannot be decoded, so there's naturally no such method. Why not post a two line example of what you're trying, and explain what you were expecting it to do. -- DaveA _

Re: [Tutor] can I make a while loop true again

2014-02-11 Thread Dave Angel
Ian D Wrote in message: > Thanks for the help on the last one. > > Is it possible to restart a while loop? This doesn't work at all (surprise > surprise) > > import turtle as t > > def start(): > global more > more = True > > def stop(): > global more > more = False > >

Re: [Tutor] Recommendation For A Complete Noob

2014-02-11 Thread Dave Angel
Bob Williams Wrote in message: > to slice those lines to get the artist and album > names into a list. > > So far, so good but my output contains duplicates, so my final task is > to work out how to get rid of them. > Hint: a set will contain only one of each item. So if you have a list o

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Dave Angel
Marc Eymard Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > Next time please post in text form rather than html, and actually include the

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Wed, Feb 12, 2014 at 02:08:17PM -0500, Dave Angel wrote: >> Marc Eymard Wrote in message: >> > ___ >> > Tutor maillist - Tutor@python.org >> > To unsubscribe o

Re: [Tutor] Performing an union of two files containing keywords

2014-02-17 Thread Dave Angel
On 02/17/2014 06:12 AM, Oscar Benjamin wrote: On 17 February 2014 09:07, Aaron Misquith wrote: The program that i'm working on just combines two files. Any help on performing an union such that a keyword would not be repeated would be appreciated. Code: with open("C:\\File1.txt") as fin1: lin

Re: [Tutor] Performing an union of two files containing keywords

2014-02-17 Thread Dave Angel
Aaron Misquith Wrote in message: > As two others have said, a set is the simplest solution to avoid duplicates. There are other questions to ask, however. Primary is whether order matters. If it does not, then observe that list(set(mylist)) will produce a list from a list without duplicate

Re: [Tutor] Performing an union of two files containing keywords

2014-02-17 Thread Dave Angel
On 02/17/2014 05:29 AM, spir wrote: On 02/17/2014 10:07 AM, Aaron Misquith wrote: I have 2 different text files. File1.txt contains: file RAMPython parser File2.txt contains: file1234 program I want to perform an union of these both files such that i get an output file3.txt which contains:

Re: [Tutor] Regarding Exceptions

2014-02-17 Thread Dave Angel
On 02/17/2014 06:44 AM, Khalid Al-Ghamdi wrote: Hi, Why is it i can use mu custom class exception without creating an exception object first? Thanks 1. class ShortInputException(Exception): def __init__(self, length, atleast): 2. Exception.__init__(self) 3. se

Re: [Tutor] Performing an union of two files containing keywords

2014-02-17 Thread Dave Angel
Oscar Benjamin Wrote in message: > On 17 February 2014 13:16, Dave Angel wrote: >> On 02/17/2014 06:12 AM, Oscar Benjamin wrote: >>> >>> Something like this: >>> >>> with open(r'D:\file3.txt', 'r+') as fout: >>> keyw

Re: [Tutor] for: how to skip items

2014-02-17 Thread Dave Angel
Gabriele Brambilla Wrote in message: > in the end I'm using something like this and it works: > zipPARApha = zip(Pampli, Pgamma, Pecut, Pb, g) > for n, (a1,b1,c1,d1,pha) in enumerate(zipPARApha): > where the arguments of zip are lists of the same size. Simpler would be: for a1,b1,c1,d1,pha

Re: [Tutor] constructing semi-arbitrary functions

2014-02-17 Thread Dave Angel
Peter Otten <__pete...@web.de> Wrote in message: > André Walker-Loud wrote: > >> Hello python tutors, >> >> I am utilizing a 3rd party numerical minimization routine. This routine >> requires an input function, which takes as arguments, only the variables >> with which to solve for. But I do

Re: [Tutor] constructing semi-arbitrary functions

2014-02-19 Thread Dave Angel
On 02/19/2014 07:33 AM, Oscar Benjamin wrote: At the least I don't understand why it needs both the argument names and the number of arguments as independent quantities. Surely len(names) would be the number of arguments... Or am I missing something? In the standard library, the attributes a

Re: [Tutor] Responding Tweet: A Twitter Bot

2014-02-20 Thread Dave Angel
Zaki Akhmad Wrote in message: > On Thu, Feb 20, 2014 at 7:39 PM, James Scholes wrote: > >> Most decent Python libraries for accessing Twitter support the streaming >> API. This lets you keep a connection to the Twitter API alive and >> process new data as it is received. There is a simple (bu

Re: [Tutor] Function help

2014-02-23 Thread Dave Angel
Scott W Dunning Wrote in message: > I am VERY new to python (programming too). I had a question regarding > functions. Is there a way to call a function multiple times without > recalling it over and over. Meaning is there a way I can call a function and > then add *5 or something like that

Re: [Tutor] subprocess.call list vs. str argument

2014-02-25 Thread Dave Angel
Albert-Jan Roskam Wrote in message: > > > - Original Message - > >> From: Danny Yoo >> To: Peter Otten <__pete...@web.de> >> Cc: Python Tutor Mailing List >> Sent: Monday, February 24, 2014 11:01 PM >> Subject: Re: [Tutor] subprocess.call list vs. str argument >> >> Last comment (ap

Re: [Tutor] subprocess.call list vs. str argument

2014-02-25 Thread Dave Angel
eryksun Wrote in message: > > > FYI, in Windows the situation is different. CreateProcess takes a > string argument, so the setup code changes to the following: > > > It's fine to use a string for args in Windows, and you may need to if > the program parses the command line differently than l

Re: [Tutor] next element in list

2014-02-26 Thread Dave Angel
rahmad akbar Wrote in message: > > then i realized i couldn't do something like .next() to the var in_file which is a list. so i added a flag start = False in which will be turned to True upon 'Rich Roberts' found. is the any simpler way to move to the next element in the list. like built in

Re: [Tutor] calling global in funtions.

2014-02-26 Thread Dave Angel
Santosh Kumar Wrote in message: > Requirement : i want to call a variable assigned outside a function scope anytime > within the function. I read "global" is a way. > Your sample code doesn't do any calling. But if your design requires you to assign to a global from inside a function, t

Re: [Tutor] viewkeys,viewvalues,viewitems : Use Cases

2014-02-26 Thread Dave Angel
Santosh Kumar Wrote in message: > want to understand about where to use , viewkeys() viewvalues() viewitems() .. Sometimes you want to loop through a dict, doing something with each of the items. For example you want to generate a report. Suppose you have a dict where the key

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Dave Angel
Bob Williams Wrote in message: > >>> linkName1 = pathList[j][0:-3] + "mp3" >> >> Isn't this exactly the same as pathList[j] ? >> > Actually, no. pathList[j] can contain either .mp3 files or .flac > files. In fact the main function of the script is to run all the flacs > through lame to conver

Re: [Tutor] Help with "Guess the number" script

2014-03-01 Thread Dave Angel
Scott W Dunning Wrote in message: In addition to Ben's observation, you don't use anything random when initializing secret. And you don't store the result of get_guess. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change s

Re: [Tutor] Help with "Guess the number" script

2014-03-02 Thread Dave Angel
Scott W Dunning Wrote in message: > > On Mar 1, 2014, at 12:47 AM, Ben Finney wrote: > >> You've bound the name ‘current_guess’ to the user's input, but then do >> nothing with it for the rest of the function; it will be discarded >> without being used. > Hmm, I’m not quite sure I unders

Re: [Tutor] How to determine which function code is being called from

2014-03-06 Thread Dave Angel
Jignesh Sutar Wrote in message: > > Hi I'm trying to exclude a certain line of code if the function is called by another function, see illustration below: Your code example is all confused, so perhaps you are as well. Why should any of your code in function A care who calls it? The main po

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Dave Angel
Mark Lawrence Wrote in message: > On 08/03/2014 01:23, Scott W Dunning wrote: > >> >> def print_hints(secret, guess): >> if guess < 1 or guess > 100: > > Only now do I feel that it's time to point out that the above line would > probably be written by an experienced Python programmer as:-

Re: [Tutor] help me

2014-03-10 Thread Dave Angel
hind fathallah Wrote in message: > > > while rm != stars:         print\         """         0 - Northe         1 - South         2 - East         3 - Weast         """         rm = raw_input("What room you want to go?: ") Why are you looping till he gets to th

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Dave Angel
Scott W Dunning Wrote in message: > Would you please stop posting in html? > def print_hints(secret, guess):     if guess < 1 or guess > 100:         print         print "Out of range!"         print     if guess < secret:         print         print "Too low!"     i

Re: [Tutor] Trying to read dBase files

2014-03-11 Thread Dave Angel
Alan Gauld Wrote in message: > On 11/03/14 18:39, Al Bull wrote: > > > >> I am using Python 3.3. I did some google searches and found something >> called dbfpy to read dbase, so I downloaded and installed it. >> >>File "C:\Python33\lib\site-packages\dbfpy\dbf.py", line 260 >> print re

Re: [Tutor] Help with Guess the number script

2014-03-12 Thread Dave Angel
Scott W Dunning Wrote in message: > > On Mar 11, 2014, at 7:50 PM, William Ray Wing wrote: >> >> Simple. In Mail Preferences -> Composing -> Message Format -> Plain Text >> (Your setting is probably currently Rich Text.) >> > Got it, hopefully that helps. Perfect, thanks. -- DaveA ___

Re: [Tutor] Loop Issue

2014-03-13 Thread Dave Angel
spir Wrote in message: > On 03/13/2014 12:40 AM, Danny Yoo wrote: >> The context is the beginning of the thread: >> >> https://mail.python.org/pipermail/tutor/2014-March/100543.html >> >> with the loop: >> >> >> ### >> while health != 0: >> ... >> ### > > The point, and reason why this

Re: [Tutor] __abs__() not acting as expected

2014-03-23 Thread Dave Angel
Jim Byrnes Wrote in message: > I am reading Practical Programming - An Introduction to Computer Science > Using Python 3. They give this example: > > >>> abs(-3) > 3 > > >>> -3 .__abs__() > 3 > Ben is right, dunder methods don't belong in introductory texts. And they seldom should be ca

Re: [Tutor] 2 Very basic queries

2014-03-25 Thread Dave Angel
Saad Bashir Wrote in message: >>> ph = float(input('Enter the pH level: ')) Enter the pH level: 8.5 >>> if ph < 7.0: ...       print(ph, "is acidic.") ...    elif ph > 7.0: ...     print(ph, "is basic.") "SyntaxError: : unindent does not match any outer indentation level. ..

Re: [Tutor] Help Noob Question

2014-03-27 Thread Dave Angel
Leo Nardo Wrote in message > > Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. I already have it open in notepad, but for the life of me cannot figure out how to open it in the interpreter. In

Re: [Tutor] while loop

2014-03-29 Thread Dave Angel
Scott W Dunning Wrote in message: > > On Mar 28, 2014, at 9:54 PM, Scott W Dunning wrote: > >> Hello, I’m working on some practice exercises from my homework and I’m >> having some issues figuring out what is wanted. >> >> We’re working with the while loop and this is what the questi

Re: [Tutor] ElementTree, iterable container, depth of elements

2014-03-29 Thread Dave Angel
street.swee...@mailworks.org Wrote in message: > I'm trying to sort the order of elements in an xml file, mostly > to make visual inspection/comparison easier. The example xml and > code on http://effbot.org/zone/element-sort.htm get me almost > what I need, but the xml I'm working with has the e

Re: [Tutor] while loop

2014-03-30 Thread Dave Angel
Scott Dunning Wrote in message: > > On Mar 29, 2014, at 12:47 AM, Dave Angel wrote: >> >> So did your code print the string 10 times? When asking for help, >> it's useful to show what you tried, and what was expected, and >> what actually resulted. >&

Re: [Tutor] while loop

2014-03-31 Thread Dave Angel
Scott Dunning Wrote in message: > > On Mar 30, 2014, at 4:29 AM, Dave Angel wrote: >> >> You're getting closer. Remember that the assignment shows your >> function being called with 10, not zero. So you should have a >> separate local variable, probabl

Re: [Tutor] exercise (while loop)

2014-04-01 Thread Dave Angel
Scott W Dunning Wrote in message: > I’m working on a few exercises and I’m a little stuck on this one. > > This is what the book has but it just gives me an endless loop. > > def square_root(a, eps=1e-6): > while True: > print x > y = (x + a/x) / 2 >

Re: [Tutor] while loop

2014-04-01 Thread Dave Angel
Scott Dunning Wrote in message: > > On Mar 31, 2014, at 5:15 AM, Dave Angel wrote: >> >> Do you know how to define and initialize a second local variable? >> Create one called i, with a value zero. >> >> You test expression will not have a literal, bu

Re: [Tutor] Gmane not picking up messages lately

2014-04-03 Thread Dave Angel
DaveA Wrote in message: > Gmane doesn't seem to be getting messages from either python tutor or python > list, for the last day or two. It's working again. > -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscriptio

Re: [Tutor] When to use classes

2014-04-09 Thread Dave Angel
Ni hung Wrote in message: (Please post in text format, not html. It doesn't matter for your particular message, but several things can go wrong, where some or most of us do not see what you meant to post) > I am learning programming using python. I think of solving a > problem using functi

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Dave Angel
Jared Nielsen Wrote in message: > Hi Pythons, > Could someone explain the difference between expressions and statements? > I know that expressions are statements that produce a value. > I'm unclear on functions and especially strings. > Are any of the following expressions? > > print(42) > print(

Re: [Tutor] masking library files

2014-04-09 Thread Dave Angel
uga...@talktalk.net Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > A message left in invisible ink. Please post in text form, not html,

Re: [Tutor] masking library files

2014-04-10 Thread Dave Angel
uga...@talktalk.net Wrote in message: > Please write in plain English if you want to be understood Like the op, you post in html. There are a bunch of things that can wrong when you do that, so you should use text mail instead. In the case of the op, he apparently changed the text color to

Re: [Tutor] Creating an Invalid message for user

2014-04-11 Thread Dave Angel
Saba Usmani Wrote in message: > > You posted in html so I can't quote your code, but why aren't you using int() to convert in one call? Second argument is the base to be used. value = int ("10011", 2) othervalue = int ("234") # default to decimal -- DaveA _

Re: [Tutor] List issues

2014-04-17 Thread Dave Angel
"Wheeler, Gabriel" Wrote in message: > (not much I could read there. This is a text mailing list, so please tell your mail program to send in text mode, not html. Only parts of your code were visible here, and your question not at all. Fortunately, Peter quoted all or most of your message. H

Re: [Tutor] equality check difference

2014-04-19 Thread Dave Angel
Alan Gauld Wrote in message: > On 19/04/14 21:48, Vipul Sharma wrote: > >> *if a == 5 and b == 5:* >> *# do something* >> >> *if a == b and b == 5:* >> *# do something * >> >> which made me think, is there any difference between the two ? > > Yes. > I don't know how python actually does

Re: [Tutor] Recognising Errors

2014-04-20 Thread Dave Angel
Saba Usmani Wrote in message: > > If for some reason you can't read this code properly as outlook has formatted it to >look messy/cluttered; you do not have to respond It'd save trouble if you continued in the same thread you started, instead of repeatedly starting a new one. And you

Re: [Tutor] inheritance and super() function in python

2014-04-22 Thread Dave Angel
Jorge Leon Wrote in message: > I think Steven has nailed your main problem, but I have two other suggestions: Use text mail, not html. This is a text list, and it can make a difference in half a dozen ways. Any decent email program has a way to select that. When showing an error, include

Re: [Tutor] loop couldn't work well and file couldn't close

2014-04-22 Thread Dave Angel
baidusandy Wrote in message: [invisible message not copied here] By posting in html, you managed to pick black on black text. I literally could see none of your message except the boilerplate. Please tell your email program to use text mode. -- DaveA _

Re: [Tutor] inheritance and super() function in python

2014-04-22 Thread Dave Angel
Jorge Leon Wrote in message: > Thank you Steve and Dave for the prompt response and advise, and sorry > about the format. > > The version of Python I'm working under is 2.7.5. About the .super(): > I'm going to try out the format you gave me for the files, and yes: >

Re: [Tutor] SMTPLIB Exception Object

2014-04-23 Thread Dave Angel
Hobie Audet Wrote in message: > It would be much better if you used text emails to post on this text list, rather than html. For one thing, your indentation might not be messed up. For another, I might be able to do proper quoting. > (you wrote): My code looks something like this:    

Re: [Tutor] Remove last newline only in print / open / read function

2014-04-25 Thread Dave Angel
Chris Wrote in message: > Hi, > > I'm a Python Newbie. Probably, this is a simple question. But what is your context? Your Python version (apparently 2.x, since you're using print as a statement, rather than a function)? What os, and what is stdout pointing to, since you're pretending that y

Re: [Tutor] trying to understand pattern matching code

2014-04-25 Thread Dave Angel
You both posted in html, rather than text mode. Joel Goldstick Wrote in message: > > > > 1. what is line means? mask[c] |= bit > This bitwise or. It sets the rightmost bit in masks[c] Only the first time through the loop, when bit == 1 -- DaveA

Re: [Tutor] Learning

2014-04-25 Thread Dave Angel
Leo Nardo Wrote in message: > I want to program. I enjoy programming and am willing to put in time > to do this.When I try to get started with programming I realize how > difficult it is to find the information worthy of learning. > I would like to write the > program in python, and I do not nee

Re: [Tutor] trying to understand pattern matching code

2014-04-25 Thread Dave Angel
rahmad akbar Wrote in message: > > to Dave, > i do i do the text mode? i had no idea this was on html Whatever mail program you're using is apparently defaulting to html. Find a menu item that specifies 'text' or 'plain text' or 'text only'.

Re: [Tutor] Help With an Assignment

2014-04-25 Thread Dave Angel
jordan smallwood Wrote in message: Do you know what a module is? Can you use a text editor to create one? Do you know what a function looks like? Try writing the first one they asked. Post it here, along with some test code showing it works, or describe what goes wrong. And while you're

Re: [Tutor] 2s complement binary for negative

2014-05-01 Thread Dave Angel
Ian D Wrote in message: > Can anyone clarify please? > > > Just reading this: > > https://wiki.python.org/moin/BitwiseOperators > > > The section on 2's complement binary for negative integers. > > > It states: > > > "Thus the number -5 is treated by bitwise operators as if it were writte

Re: [Tutor] append vs list addition

2014-05-04 Thread Dave Angel
C Smith Wrote in message: > > I had always assumed that append() was more efficient, but some recent discussions seem to point at that it is the same as append(). Which is preferable and why? Please be more explicit, preferably with example code. list.append and list.__add__ don't even do th

Re: [Tutor] Help With Code

2014-05-04 Thread Dave Angel
jordan smallwood Wrote in message: > > want to have the user try again if they enter in a non integer. What am I > missing: Do you perhaps mean float? If so, see the other response. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscr

Re: [Tutor] Logical error?

2014-05-04 Thread Dave Angel
Danny Yoo Wrote in message: > > > > >> Hopefully, this makes the point clearer: we must not try to decode >> individual lines. By that time, the damage has been done: the act of >> trying to break the file into lines by looking naively at newline byte >> characters is invalid when certain cha

Re: [Tutor] Keeping change-in-place vs. copy methods straight

2014-05-04 Thread Dave Angel
Alan Gauld Wrote in message: >>> (not a copy!) to the sorted item. >> >> sorted() does make a copy of the list: > > Really? That's a bummer. > I assumed (never assume!) that it returned a reference to the original. > I really, really, hate the way Python handles this :-( > It's not clear to me

Re: [Tutor] append vs list addition

2014-05-06 Thread Dave Angel
C Smith Wrote in message: > Sorry. > > I meant for example: > list1 = [1,2,3] > list2 = [3,4,5] > > newList = list1 + list2 > > versus > > for x in list2: > list1.append(x) > > Which is the preferred way to add elements from one list to another? Thank you for switching to text mail. The

Re: [Tutor] append vs list addition

2014-05-06 Thread Dave Angel
Denis Heidtmann Wrote in message: > On Sun, May 4, 2014 at 6:44 PM, Dave Angel wrote: >> C Smith Wrote in message: >>> Sorry. >>> >>> I meant for example: >>> list1 = [1,2,3] >>> list2 = [3,4,5] >>> >>> newList = lis

Re: [Tutor] Help with Python

2014-05-11 Thread Dave Angel
On 05/10/2014 11:16 PM, Glen Chan wrote: Hello, I am a student trying to figure out Python. I am getting errors that I don't know how to fix. What do you do after you get the error message and something is highlighted? Does that have to be deleted? Anyway, here is what I mean... def main():

Re: [Tutor] While Loop?

2014-05-14 Thread Dave Angel
On 05/14/2014 05:45 AM, Sam Ball wrote: I'm attempting to create a program where the user inputs their account number (which must be 8 digits) and if what the user enters is not 8 digits in length I want python to tell the user this is invalid and then keep asking for the account number until

Re: [Tutor] (no subject)

2014-05-14 Thread Dave Angel
On 05/14/2014 04:48 PM, JEAN MICHEL wrote: I'm a Python beginner Welcome to python-tutor trying write a program that reads outside txt files, What's an "outside txt file"? And since you only one file, perhaps you left out the othertwo? takes the data like the name and test grades of s

Re: [Tutor] Set values from list as per user input

2014-05-21 Thread Dave Angel
Shweta Kaushik Wrote in message: > Hi All, > > I am new to python. Please help me. > I have to create one function which can set values sent by user from a list > of values. > > For eg: > I have a list having values between 1 to 100. > List = ['1', '2', ... '100'] > > I have to write a functi

Re: [Tutor] Option on How to create web Interface

2014-05-21 Thread Dave Angel
fabu desay Wrote in message: > If I got the problem correctly What problem is that? I see no context. > ,you can equally create + open a file > file = open(filename,+wr) But the second argument must be a string. I cannot imagine any content in the wrong variable that would produce a strin

Re: [Tutor] Move files to a new directory with matching folder names

2014-05-22 Thread Dave Angel
questions anon Wrote in message: > Please use text mail to post, as html has a number of problems. In your current message, indentation is lost. Also don't top-post in this forum. Any selective quoting of previous context should precede your comments. Your logic presently tries to copy a d

<    14   15   16   17   18   19   20   21   >